Sunday, February 10, 2013

Configuring a development environment for Mac OS X

Here are the steps I took for installing and configuring the various tools I needed for C++/C and Java development in Mac OS X:

  1. Terminal
    1. iTerm2 is recommended over the native Terminal as it is more Linux-compatible.
    2. Configure ~/.bash_profile and put your favorite aliases in it.
    3. Add color to your terminal. There is also a cool LS color generator
    4. Configure ~/.vimrc if you use vim/vi :)
    5. Add syntax on to ~/.vimrc if you want color syntax highlighting.
  2. Git
    1. If you use git for source control, then google for and download it. Installation is straightforward.
    2. Don't forget to do git config --global /
    3. To add color to git output, do this: git config --global color.ui true
  3. SSH keys
    1. SSH keys are needed for git. 
    2. mkdir -p ~/.ssh ; pushd ~/.ssh ; ssh-keygen -t rsa -C ""
    3. Upload the generated public key to your github / bitbucket account.
  4. XCode (clang/clang++, gcc, g++, make, ...)
    1. Install XCode from the App Store. (You'd need an Apple ID)
    2. Put XCode in your dock.
    3. After installation, open XCode, and go to Preferences -> Downloads from the menu bar.
    4. Click to install Command line tools.
    5. Be warned that the version of gcc that shipped with XCode 4.6 (latest as of now) is only 4.2.1 (July 2007), without any support for C++ TR1 and v11. It is seriously ancient. clang on the other hand is relatively newer (LLVM v3.2). I guess they are conservative about g++'s unstable support for C++ 11.
  5. Java
    1. JDK and JRE come installed by default.
    2. Type javac -version and java -version to check their versions.
    3. You'd probably want to install an IDE such as Eclipse.
  6. Ruby / Perl / Python / PHP
    1. Also, these come installed by default. There is also the Apache web server!
    2. Actually, in general, don't expect default-packaged software to be bleeding edge. I haven't tried replacing the default copies yet so I can't tell you how to.
  7. Homebrew (Package manager)
    1. Check out this awesome package manager which is similar to Ubuntu's apt-get.
    2. You use this to install your favorite utilities such as pkg-config, wget, dos2unix and etc.
  8. Sublime Text
    1. This is my personal favorite programmer's text editor that functions like a mini IDE, with simple building functionality and folder browsing. Pretty much reminded me of Notepad++ in Windows!
  9. TextWrangler
    1. In my opinion, this is pretty good but lacks the building and folder browsing ability.
  10. pkg-config (Forget this if you wanna use homebrew)
    1. This handy tool spits out the gcc/g++ compatible compilation/linking flags for specified libraries.
    2. Download and install from
    3. This installer installs to /opt (instead of /usr/local)
    4. Add pkg-config to the path (system-wide):
      1. Create a file /etc/paths.d/pkgconfig with /opt/pkgconfig/bin as its content.
    5. Configure the PKG_CONFIG_PATH environment variable. You'd probably want to set this environment variable system-wide. I have this set to /usr/lib/pkgconfig:/usr/local/lib/pkgconfig
Other stuff:
  1. UI enhancements: such as adding a spacer to your dock and making lists look better.
  2. Multi-media
    1. uTorrent for your ahem, ____ needs.
      1. Don't forget to enable IPFilter. In the main window, do Command+Option+, to bring up the options window with the advanced tab. Set ipfilter.enable to true.
        You can get the ipfilter auto updater 
    2. Spotify, for music to help keep you sane while you code away.
    3. VideoLAN, the ultimate video player that can handle almost every format.

No comments:

Post a Comment