Lately there have been a few people with Linux backgrounds trying out OS X, so I realized I tended to always give the same tricks and explanations, so I might as well factor them out here. The first thing I would recommend Linux users is to take a deep breath: Mac OS X is a form of Unix, but it is not Linux. It is closer to BSD or even Solaris. Some things are different, get over it. Some things are more difficult or impossible some are easier and some hacks are not needed, like the hacking around needed to have an ssh-agent running.
You will probably want to launch the terminal and get back to a command line interface, the terminal is, from the root disk
Applications ⇒ Utilities ⇒ Terminal. By default OS X comes with a reasonable set of BSD command-line tools, but there is a good chance that your favorite tool is not present, to get it, you will need to do two things: install the developer tools and the darwin port package manager. The developer tools are an optional install on the installation DVD provided by Apple. You can also download them from the Apple web-site, you just need to register. Once the darwin-ports is installed you can go forward the Unix way:
You can install most open-source tools. OS X has an X11 server installed, but it is only started on demand, this is why the
DISPLAY variable contains a weird looking socket. The socket connects to launchd that will start the server on the first connection.
While it is possible to install familiar tools, there are a few Mac OS X only command-line tools that are worth considering:
- This is probably the most handy Mac OS X command-line tool, it basically opens documents and launches GUI applications. You can use it whenever you want to emulate a click on a Finder Icon (the file-system explorer). So if you want to open the current directory
open .. The
opencommand also understands URL.
- pbcopy, pbpaste
- Those two command put the content of
stdininto the clipboard and dump the content of it to
stdout. Basically they have the same functionality than
- Dumps the system profile, this is useful to have a view of what hardware the operating system has detected.
- mdfind, mdls
- Those commands give access to the Spotlight meta-data. They are useful for searching for files and inspecting their meta-data respectively.
- hdiutil, diskutil
- Those are the tools to manipulate disk images and actual disks. They expose the functionality of the GUI tool Disk Utility.
- Well behaved Mac OS X applications store their preferences in standard property files. The files are in
~/Library/Preferences, but you can just manipulate them using the
- Outputs the content of
stdinto the speech synthesizer. Useful for long running scripts.
- This command lets you execute Applescript commands from the command line. This means that you can control GUI programs like Word or Photoshop from the a shell script. The langage can be quite complex, but you can do quite neat things. For instance this small script makes an application quit cleanly.
#!/bin/tcsh set osa = 'Tell Application "'$1'" to Quit' osascript -e "$osa"
All those commands have man pages (and none of this info non-sense). The Mac OS X hints web site is also a good source of information on ways to hack the system. One trick I used regularly is this script to create bash aliases for all GUI applications.