mac – eBlog https://emresaglam.com/blog My Blog about my life and my thoughts... Wed, 12 Oct 2016 03:20:46 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.3 No timer in Mac OS X? No problem! https://emresaglam.com/blog/blog/2016/10/11/no-timer-in-mac-os-x-no-problem/ https://emresaglam.com/blog/blog/2016/10/11/no-timer-in-mac-os-x-no-problem/#respond Wed, 12 Oct 2016 03:20:46 +0000 http://emresaglam.com/blog/?p=1166 Continue reading No timer in Mac OS X? No problem! ]]> Mac OS X doesn’t come with a timer installed by default. There are bunch of timers in the App Store, you can definitely install one of those.

But here is how to make one from scratch. Open terminal screen and type:

sleep 5 ; say "Time is up"

Well that’s it 🙂 This command will sleep for 5 seconds and say “Time is up” at the end of 5 seconds.

We can make a little script out of it and save as /usr/local/bin/timer as below:

#!/bin/bash
sleep $1 ; say "Time is up"

You can invoke the command like this, it will sleep 5 seconds and tell you “Time is up”:

timer 5

As a bonus, if you want minutes instead of seconds, you can always do something like this which will run the timer for 5 minutes:

timer `echo "5*60" | bc`

]]>
https://emresaglam.com/blog/blog/2016/10/11/no-timer-in-mac-os-x-no-problem/feed/ 0
Mac OS X trick for selecting audio input/output easily. https://emresaglam.com/blog/blog/2012/08/01/mac-os-x-trick-for-selecting-audio-inputoutput-easily/ https://emresaglam.com/blog/blog/2012/08/01/mac-os-x-trick-for-selecting-audio-inputoutput-easily/#respond Wed, 01 Aug 2012 17:47:36 +0000 http://emresaglam.com/blog/?p=1069 Continue reading Mac OS X trick for selecting audio input/output easily. ]]> You might sometimes have multiple audio Input/Output devices connected to your Mac. An easy way to switch between then is to Option+Click on the speaker icon on your taskbar. You will see a dropdown menu that lists all the audio devices that you have. Then you can click either one of those.

Here is a mini video. (My second click is while holding the Option button)

 

]]>
https://emresaglam.com/blog/blog/2012/08/01/mac-os-x-trick-for-selecting-audio-inputoutput-easily/feed/ 0
Mac OS X pkg files https://emresaglam.com/blog/blog/2011/09/08/mac-os-x-pkg-files/ https://emresaglam.com/blog/blog/2011/09/08/mac-os-x-pkg-files/#comments Thu, 08 Sep 2011 19:25:54 +0000 http://emresaglam.com/blog/?p=1035 Continue reading Mac OS X pkg files ]]> PKG FilesSometimes you need to see what’s inside of that pkg file. But you also don’t want to install it. You just want to take a look at the files in it before installing it. Well, here is how to do it:

PKG files usually come in a DMG image. First mount that file by double clicking on it. Then open a Terminal window and go to the folder where it’s mounted. (Look under /Volumes)

Once you are in that folder you will see a file with a .pkg extension. Let’s say it is called Foo.pkg. Copy that file in a folder, I’ll copy it to /tmp.
cp Foo.pkg /tmp
cd /tmp

Mac OS X has a utility called pkgutil. You can do a ton of stuff with it, so check the manual page. (man pkgutil) But for our exercise we will just use it to expand the pkg file.
pkgutil --expand Foo.pkg /tmp/foo_package
cd /tmp/foo_package

This will open the pkg file to a flat structure. You will see some files and folders like Distribution, Resources, Foo.pkg. Go ahead and cd in the directory Foo.pkg:
cd Foo.pkg

In there you will several files. The important ones are Bom, Payload and PackageInfo:

Bom:

This file is called Bill of Materials. It describes what is in this pkg file and where they will be written to. If you will not do file/binary analysis of the contents of the pkg file and you want only to see which files will be written where, this is your file. You can also use this file’s contents to remove the package completely. (I leave this exercise up to you)

Bom is a binary file and there is a tool to list its contents: lsbom. (man lsbom for usage) Basic usage would be:
lsbom Bom

This will print file/directory structure of the contents on the screen.

Payload:

This is the file that contains all the files and directories in this pkg file. It’s a gzipped archive file.
$ file Payload
Payload: gzip compressed data, from Unix
$ mv Payload foo.gz
$ gunzip foo.gz
$ ls
foo

This will give you a file called foo. Now you need to use cpio to extract that archive.
$ cpio -iv < foo
.
./System
./System/Library
./usr
./System/Library/LaunchAgents
./usr/bin
......files files files.......
50002 blocks
$ ls
System foo usr

In my case it unarchived two folders called System and usr.

No you can go and browse these directory to find files you are looking for. Have fun 😉

]]>
https://emresaglam.com/blog/blog/2011/09/08/mac-os-x-pkg-files/feed/ 1