Nov 23, 2009

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.

Environment Variables

  • Programs running in Terminal reference variables defined in ~/.profile
  • Applications get variables from ~/.MacOSX/environment.plist

Java

  • 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
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

  • 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

MySQL

  • 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

Oracle
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.

About the Author

Object Partners profile.

One thought on “Mac OS X Development Hurdles

  1. Eric Foster-Johnson says:

    Excellent write-up.
    Thanks,
    -Eric

Leave a Reply to Eric Foster-Johnson Cancel reply

Your email address will not be published.

Related Blog Posts
Natively Compiled Java on Google App Engine
Google App Engine is a platform-as-a-service product that is marketed as a way to get your applications into the cloud without necessarily knowing all of the infrastructure bits and pieces to do so. Google App […]
Building Better Data Visualization Experiences: Part 2 of 2
If you don't have a Ph.D. in data science, the raw data might be difficult to comprehend. This is where data visualization comes in.
Unleashing Feature Flags onto Kafka Consumers
Feature flags are a tool to strategically enable or disable functionality at runtime. They are often used to drive different user experiences but can also be useful in real-time data systems. In this post, we’ll […]
A security model for developers
Software security is more important than ever, but developing secure applications is more confusing than ever. TLS, mTLS, RBAC, SAML, OAUTH, OWASP, GDPR, SASL, RSA, JWT, cookie, attack vector, DDoS, firewall, VPN, security groups, exploit, […]