Refresh of my development system
by Sebastien Mirolo on Sat, 26 Nov 2011First the track pad stopped working, then the notebook would heat-up when I flip the screen down and put it in my bag; to the point it would not come back up without a hard reset. After two years and a half, it is time to upgrade. I like the 13'' form factor so I just got a new MacBook Pro, increased specs, better cpu, more memory, and oh yes, an SSD hard drive.
I turned the MacBook Pro on and followed the setup. The steps are easy to follow but for some reasons pressing "enter" does not move panels forward. It requires to click on the arrow.
Once on the "Create Your Computer Account", I entered information I will use for the admin account. I will later create another, regular, account for daily use. On that panel I also unchecked "Allow my Apple ID to reset this user password". I have no idea how this feature is implemented but this looks like a security risk to have some else be able to remotely reset the admin password on my local machine. The "Finishing Up" panel was a little confusing but I was finally able to start using Mac OSX Lion. I skipped the iCloud registration and moved to setup my machine the way I like it.
System configuration
Previously, I had devised two partitions (one for the system and one for my data). There was a bug in Snow Leopard such that when I did a hard reset, it would not be able to mount the data partition (hence not find the home directory) on a subsequent power up. It usually took a few power up/down cycles before eventually the partition would mount. That became very annoying when the overheat issue started a month ago. There still seems to be problems with multiple partitions in Lion so I sticked with a single one this time around. I have no need for multi-boot anymore and running rsync periodically is good enough to backup the information I care about.
It is common knowledge that the only way to avoid data leakage on disk is to use whole disk encryption. This is even more so when you understand SSD disk internals. Temporary files virtually last forever on disk and whole disk encryption is thus a must.
System Preferences > Security & Privacy > FileVault
After an hour and a half, the whole disk was encrypted and it was time to move forward with the system configuration. Next, turning on the firewall.
System Preferences > Security & Privacy > General Check "Disable remote control infrared receiver" > Firewall > Start > Advanced Check "Block all incoming connections" > Privacy Uncheck "Enable Location Services"
With the basics taken care of, it was time to move on to create a standard account and configure the login screen.
System Preferences > Users & Groups > Login Options Check "Display login window as Name and Password" Uncheck "Show the Sleep, Restart, and Shutdown buttons" Uncheck "Show password hints"
When I log out and log back in, The login window still greets me with a list of users and their pictures. I was baffled about this for some time until I found a thread that explains Filevault replaces the standard login app with its own EFI-based one and ..., yes, the Name/Password feature is not supported there :(.
I always login into the standard account from then on, relying on the admin account solely for system-wide (i.e. root level) configuration.
Her a few settings I prefer better than the default ones for Finder
> Finder.app > Preferences > General New finder windows show: my home directory > Sidebar Check "Favorites: my home directory" Check "Devices: Hard disks" > Advanced Check "Show all filename extensions" Uncheck "Show warning before emptying trash" When performing a search: Search the current folder # Show all files, type in a terminal window: $ defaults write com.apple.Finder AppleShowAllFiles YES # or change the nohidden flag on ~/Library $ chflags nohidden ~/Library/
Now I really do not like Terminal.app to show all commands I typed and their output even after I restarted Terminal.app or even the whole system. Apparently this can be prevented by disabling the Lion's resume feature system-wide.
System Preferences > General Uncheck "Restore windows when quitting and re-opening apps" # A few more personal preferences Terminal.app > Preferences > Startup New window with settings: "Pro" New tabs open with: "Default Working Directory"
I also transferred ~/.bash_profile, ~/.emacs, ~/.ssh and ~/.gnupg to the new machine. Suddenly, it already feels a lot more like home.
In previous setups I used Spark to bind screen locking to Ctrl+Alt+Del. I though found out recently that there is already a shortcut available to lock the screen: Ctrl+Shift+Eject.
Installing Applications
After an usual and almost mandatory "Software Update", I rebooted and started to install the applications I use every day.
Xcode |
MacPorts |
Emacs |
VMware Fusion |
Other Tools |
Xcode 4.2
When I first installed Xcode (version 4.2) through the MacApp store I did not expect so much trouble down the line. The first C source I compiled turned up a bug in LLVM, the default optimizer back-end for Xcode from now on.
Ran out of registers during register allocation!
A search through the web shows a lot of projects affected by that bug. To be fair it might now be fixed, but the fix obviously did not ship with Xcode 4.2. It did not ship with Xcode 4.2.1 either (released on 17 November 2011). "-disable-physical-join" is not a recognized flag and "-O1" still stops on the optimizer error so out of LLVM workarounds I decided to go back to a battle field tested gcc.
The problem is that now Xcode 4.2 does not ship with a gcc-4.2 alternative as all Xcode until 4.1 did. I was lucky enough to be able to stumble upon this post and still be able to download Xcode 4.1 from the apple website. The instructions in the post did not work for me but after three downloads of Xcode (4.2, 4.2.1, 4.1 - about 12Gb, 6 hours) and an endless number of trial and errors, the following did:
# Download Xcode 4.2.1 # Run /Applications/Xcode\ Installer.app # Force Quit Xcode $ mv /Applications/Xcode\ Installer.app \ /Applications/Xcode\ Installer-4.2.1.app $ pkgutil --forget com.apple.pkg.InstallXcodeLion # Mount xcode_4.1_for_lion.dmg # Run /Volumes/Volumes/Install\ XCode/InstallXcodeLion.pkg (in GUI mode) $ mv /Applications/Xcode\ Installer.app \ /Applications/Xcode\ Installer-4.1.app $ installer -dumplog -allow -pkg /Applications/Install\ Xcode-4.1.app/Contents/Resources/Packages/gcc4.2.pkg -target / $ gcc --version i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 \ (Based on Apple inc. build 5658) \ (LLVM build 2336.1.00) $ gcc-4.2 --version i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 \ (Based on Apple inc. build 5666) (dot 3)
There is finally one command I tried at various point that did not help. None-the-less it is worth remembering for later use.
$ /Developer/Library/uninstall-devtools --mode=all
Macports
In comparison to Xcode, installing MacPorts was a breeze. I downloaded MacPorts-2.0.3-10.7-Lion.dmg, ran the installer and I was then ready to execute usual /opt/local/bin/port commands.
Emacs
I installed all the packages I use to customize emacs as follow. Since I also write a lot of Scala code these days, I installed scala emacs mode.
$ /opt/local/bin/port install scala29 $ ls -la /opt/local/share/scala-2.9/misc/scala-tool-support/emacs $ diff -u prev ~/.emacs +(add-to-list 'load-path "/opt/local/share/scala-2.9/misc/scala-tool-support/emacs") +(require 'scala-mode-auto)
VMware Fusion
When I need to try different web stacks, I setup virtual machines for that. When I need to try display websites on different OSes and browsers, I setup virtual machines for that. Qemu can be installed through MacPorts but it runs the VMs at snail speed. I still rely on VMware Fusion for the time being.
After installing VMware Fusion (here version 3.1.1), I copied the three semi-persistent VMs I originally created (see Setting-up my development system and Snow Leopard Upgrade) as well as the DHCP leases file (/var/db/vmware/vmnet-dhcpd-vmnet8.leases) that insures the VMs always have the same IP addresses.
Other Tools
Though I am mostly looking at diff outputs in emacs, Diffmerge is a useful tool at times. I created a shell script to launch from the command line as follow.
$ cat /usr/local/bin/diffmerge #!/bin/sh /Applications/Diffmerge.app/Contents/MacOS/DiffMerge --nosplash $* &
A nice little tool that often do the trick is 0xED, an Hex Editor for Mac OSX.
If there is only one software application you must buy for the Mac, I definitely recommend OmniGraffle. There is just no other diagramming tool that simply work. Get a version that can export SVG files and you are set.
On occasions I need to view, sometimes edit, a few images and docs. For that Graphviz, Gimp and LibreOffice are useful as well as, both, free as beer and free as freedom.
There are pre-built OSX .app available on the web for both Graphviz and Gimp but it seems as simple if not simpler to install them through macports.
$ /opt/local/bin/port install graphviz-gui # The command I used to workaround an install conflict. $ /opt/local/bin/port install gimp-app -help_browser
Too many frequent updates, regularly breaking plug-ins and frequent crashes, I grew tired of Thunderbird first, then Firefox. Today I use Google Chrome for both browsing and web development.
I use Adium to interact with most instant messaging system. Of course many times I also need to talk to people that are on Skype.
E-mail archives
I copied over ~/Library/Mail but that did not seem enough to get things going. So I re-created my email accounts (currently I have five). I was happily surprised when Mail.app configured my Hotmail account semi-magically since it was the only account I had not been able to access through an email client so far.
When it came to gmail, Mail.app insisted to use IMAP when I wanted POP. I finally found out that pressing the option key in the "New Account" dialog box will change the "create" button into "continue" and give me the opportunity to set the account type to POP.
After Mail.app created a few mailboxes, it did not take much time to realize paths to messages should be updated
from ~/Library/Mail/<>MailboxName/Messages to ~/Library/Mail/V2/<>MailboxName/Key/Data/digit/Messages
Then the indexes and caches should be rebuilt, which can be done through the menu interface
> Mail.app > Mailbox > Rebuild
By default Mail.app now uses a three-columns display (to take advantage of wide-screens) but I still prefer the classic layout. So I reverted that behavior. I also prefer to avoid distraction of sound and pop ups when new messages arrive so I tuned those settings as well.
> Mail > Preferences > Viewing Check "Use classic layout" > General New messages sound: "None" Dock unread count: "None"
Apache2 Configuration
Using a local virtual machine is very convinient for web development but running a local http server is even better for tasks that do not require heavy system setups.
> System Preferences > Sharing > Web Sharing $ tail /var/log/apach2/access_log ::1 - - [21/Nov/2011:15:55:00 -0800] "GET / HTTP/1.1" 304 - # localhost is responding on IPv6 now $ diff -u prev /etc/apach2/other/mysite.conf -<VirtualHost 127.0.0.1:7880> +<VirtualHost [::1]:7880> $ /usr/sbin/apachectl restart