Mac OS X Primer: Migrating from GNU/Linux to Mac for software engineers

A collection of small things which I wish were available when I started using Mac OSX for software development. (See my previous post The weird state of laptop industry  for the why people who cannot withstand MS Windows are pretty much out of choice for a good quality GNU/Linux laptop). Mac is based on Open BSD which is similar to GNU/Linux but there are quite a few major differences from GNU/Linux.  (Disclosure: My exposure to BSD is limited therefore, I won’t even try to draw that comparison here). Following are some things that I learnt and have been useful.

Softwares Packages

Software Installation is weird on Mac (compared to GNU/Linux) Most softwares come in form of .dmg file (think .msi for windows). Open the dmg and then drag the file to Applications directory. To uninstall, one can just delete the directory. All such softwares packages are stored in /Applications directory.

  1. Finder (installed by default) – Mac equivalent of Gnome Nautilus or Windows Explorer (Gotcha: Cmd + O – opens the file while “enter” edits the filename)
  2. iTerm2 - Terminal app
  3. XQuartz - for running X11 based softwares (think Wireshark)
  4. Quick silver - install the app, use Cmd + space to trigger it and type anything from filename to application name
  5. Zipeg - Archive viewer
  6. Xcode - Development Tools  (IMHO, its impossible to live without this a lot of other packages mentioned further require this).
  7. VMWare fusion - for running GNU/Linux virtual machines, its not free, I think other alternatives like VirtualBox are good as well. Some people combine this with Vagrant.
  8. MacVim – For those who just want to use Vim without the terminal (personally, I prefer vim instead).
  9. MplayerX - for watching offline videos

Mac does not come with CLI based package management tool (like apt-get or yum) or at least I have not found any. The solution to that is homebrew (I have tried macports and I hated it, homebrew is more polished). Eg. to install wget (its not installed by default), one can use brew install wget To look around for brew formulas related to GNU coreutils use brew search coreutils While brew is primarily meant for installing command line GNU/Linux style tools, brew cask allows one to install .dmg packages from command line as well. Eg.

I started using brew cask only recently and my setup can be seen here. For python based packages use easy_install or pip (IMHO, debate of easy_install vs pip is similar to debate of apt-get vs aptitude). For ruby based packages use gem install - default version of ruby is old, upgrade using brew, some people prefer rvm, which I think is overkill unless the laptop is used for ruby based software development.For node.js based packages install npm (brew install npm) Disclosure: I have not done any rigorous C/C++ development on Mac, so, I am not really certain if its an area which requires a fix or not.

CLI

  1. Bash shipped with Mac is old, upgrade to latest.
  2. pbcopy, pbpaste – interacts with pasteboard (clipboard)
  3. open is the standard command for opening any file (it chooses relevant application).
  4. defaults is a useful OS X specific command which is used for modifying settings of various apps via command line, use

    to see list of all such settings.
  5. Default autocomplete settings for commands in Mac is crappy (my collection of fixes can be seen here)
  6. A lot of other settings in Mac by default are not developer friendly, my .osx file is here, its based on the legendry .osx files from Mathias. (dotfiles is a topic in itself for some other day, in the meanwhile feel free to read my dotfiles and also checkout http://dotfiles.github.io/)

Minor Things

  1. Filenames are case-insensitive - by default, Mac OS Extended (Journaled) file system is case insensitive.
  2. Right mouse click – Cmd + click
  3. Closing a window does not closes the application, Cmd + Q does.
  4. Default key repeat speed is annoyingly slow for programming, fix that using (taken from source)
  5. Try out two finger, three finger and four swipes on the trackpad, its pretty amazing.
  6. All credentials (like wifi passwords, certificates etc.) are stored in Keychain app
  7. To list all applications installed on the system use (source)

    (system_profiler in general, is a pretty useful command as well).

Some more reads

  1. https://news.ycombinator.com/item?id=7051091
  2. http://www.infoworld.com/d/applications/top-20-os-x-command-line-secrets-power-users-202466?page=0,0