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.
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.
- Finder (installed by default) – Mac equivalent of Gnome Nautilus or Windows Explorer (Gotcha: Cmd + O – opens the file while “enter” edits the filename)
- iTerm2 – Terminal app
- XQuartz – for running X11 based softwares (think Wireshark)
- Quick silver – install the app, use Cmd + space to trigger it and type anything from filename to application name
- Zipeg – Archive viewer
- Xcode – Development Tools (IMHO, its impossible to live without this a lot of other packages mentioned further require this).
- 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.
- MacVim – For those who just want to use Vim without the terminal (personally, I prefer vim instead).
- 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.
$ brew cask install google-chrome
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.
- Bash shipped with Mac is old, upgrade to latest.
1$ brew install bash
- pbcopy, pbpaste – interacts with pasteboard (clipboard)
12$ echo "copy this to clipboard" | pbcopy$ pbpaste # Pastes the content of clipboard
- open is the standard command for opening any file (it chooses relevant application).
- defaults is a useful OS X specific command which is used for modifying settings of various apps via command line, use
1$ defaults read
to see list of all such settings.
- Default autocomplete settings for commands in Mac is crappy (my collection of fixes can be seen here)
- 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/)
- Filenames are case-insensitive – by default, Mac OS Extended (Journaled) file system is case insensitive.
- Right mouse click – Cmd + click
- Closing a window does not closes the application, Cmd + Q does.
- Default key repeat speed is annoyingly slow for programming, fix that using (taken from source)
1$ defaults write NSGlobalDomain KeyRepeat -int 0
- Try out two finger, three finger and four swipes on the trackpad, its pretty amazing.
- All credentials (like wifi passwords, certificates etc.) are stored in Keychain app
1$ open -a "Keychain Access"
- To list all applications installed on the system use (source)
1$ system_profiler SPApplicationsDataType -xml
(system_profiler in general, is a pretty useful command as well).
Some more reads