Mac OS X Development Hurdles
The Mac is popular, there’s no doubt about it. So after years of development with Windows and Linux, I finally got the chance to develop with a new MacBook Pro Snow Leopard. Although things have been fairly smooth, I did run into quite a few hurdles and difficulties figuring out how to do some of the mundane daily tasks on this shiny little beauty. I’m not saying one is better than the other, but they’re just different (especially being so used to developing on a Windows or Linux laptop). With all my trials and tribulations I went though, I figured others ran into similar issues more than likely . So following is a list of the differences that took me the longest to track down, and the ones I need to reference periodically.
- Programs running in Terminal reference variables defined in ~/.profile
- Applications get variables from ~/.MacOSX/environment.plist
- The Java version is set in Applications/Utilities/Java Preferences.app
- Set your Java Preference for apps running in terminal by adding this line to your ~/.profile export JAVA_HOME=`/usr/libexec/java_home`
Apache may be the same for Linux as the Mac. When I was developing with a Linux box I installed Apache in it’s own directory and didn’t use the default locations.
- To start apache, go to System Preferences, Sharing, click Web Sharing
- apachectl is located in /usr/sbin
- Log files are in /var/log/apache2
- Config files are in /etc/apache2
- Pages are stored in 2 locations
- Global pages are stored in /Library/WebServer/Documents
- Personal pages are stored in /Users/yourname/Sites/
- View pages at http://localhost
- View personal pages at http://localhost/~yourname/
- php.ini needs to be created in /etc
- /etc/php.ini.default can be copied to php.ini
- Uncomment the LoadModule php5_module in /etc/apache2/httpd.conf file
- In /etc/hostconfig MYSQLCOM=-YES- starts MySQL automatically.
- The start script is /Library/StartupItems/MySQLCOM/MySQLCOM start but only works if hostconfig is set to yes.
- I copied the MySQL start script into /Users/~yourname/scripts and removed the MySQLCOM checking so I can start/stop MySQL at will
Good luck. Oracle is not available for the Mac. Your best bet is to install a Windows or Linux Virtual Machine and run Oracle inside of that.
Overall, the difficulties I experienced were trivial and would not prevent me from recommending Mac OS X to anyone interested in switching to a new development environment. I’m sure the future will bring plenty of other nuances and work arounds for the Macbook, but I’m very happy I had the opportunity to switch development environments and continue to enjoy developing with it. I think we typically all despise change and that conventional adjustment period, but hopefully these tips will reduce the time it takes for you to become productive with the switch.