Migrating from Linux to OS X

I’ve been promising to write up my initial reaction to using OS X. This article along with the other one I wrote called Why my Desktop is OS X sum up my initial reaction to OS X. Read on for more.


Introduction

Having recently migrated from Linux to OS X I’ve been spending time getting used to my new environment. Since OS X has a UNIX core I’ve spent the majority of my time making it work and act like my old Debian workstation. So far this hasn’t involved much except changing my shell and few other key things.

Stock UNIX applications

OS X comes with virtually everything you can think of. The long list includes Apache, PERL, vi, ssh, and even PEAR (though PHP is not installed by default). Even the applications such as tr, sort, uniq, cat, and tar are all there. The cool thing that Apple did was use established open source software for such things as web sharing (in reality Apache). There were a few missing applications, like vim, but for the most part OS X is a pretty robust UNIX.


Directory structure

One thing you should take note of is OS X’s file directory structure. There isn’t a /home, instead there is a /User. ~/public_html is replaced with ~/Sites. There are a few other things to note. Aqua doesn’t list directories such as /etc and /usr so if you want to move around in those directories you’ll need to drop down to the shell. Those are the few eccentricities that I’ve found thus far. For the most part everything is where it usually is and if it’s not there it’s easy to find.


XDarwin

Yes you can run your native X applications in OS X. Just download the package, install it, and click on the X in your dock. It basically runs in the background allowing you to run X applications managed by Aqua. A friend of mine has successfully installed all sorts of applications using fink, including the GIMP. You can get XDarwin at http://www.xdarwin.org.


Fink

A must have for any former Linux user is fink (http://fink.sourceforge.net). It works much like apt-get from Debian. Once you have that installed you just need to type “fink install [package]” to have it install one of the many packages in the fink package tree. I’ve installed mysql, rsync, and bash using this program without any problems. You’ll notice that when you first try to install something via fink you need to choose how X is installed. If you have already installed XDarwin just choose the first option saying you have already installed an X environment.


Changing your default shell

The first thing most Linux users will notice is that OS X, being a part of the BSD family, uses tcsh as its standard shell. Since all Linux distros that I know of come stock with bash I decided to go about changing my default shell to bash. To begin with you need to install bash. Since you should already have fink install jut type “fink install bash”. Once that is done, open up your term application and go to preferences to change your default shell to /sw/bin/bash. I would also recommend adding /sw/bin/ and /sbin to your $PATH in your .bashrc file. Note the fink version uses .bash_profile so ln –s that to your .bashrc (or just use that file instead).


Other applications to consider

You might also consider installing some other applications that you usually have on Linux. Apache+PHP is extremely easy to install – OS X comes with PEAR already installed. Another must have upgrade, in my opinion, is VIM – “fink install vim” worked great for me (make sure /sw/bin is in your $PATH).


Some oddities

There are some strange not-quite-UNIX anomalies I’ve found since I started using OS X. First off the familiar chsh command would not change my shell to /sw/bin/bash. Another oddity is that /etc/profile doesn’t work, which isn’t a huge deal since .bash_profile in my $HOME worked fine. Probably the weirdest thing is how it stores and handles users. As far as I can see /etc/passwd doesn’t seem to store username information like Linux does. In fact, I’m not sure where the heck it stores my password information. While BSD users may not have any problem with the init scripts, Linux users used to the System V way of doing things will be a little lost. I haven’t really looked into it, but I’m not sure how one might go about starting MySQL or Apache during startup.


Conclusion

OS X can easily be turned into a Linux type environment. With the quick changes above any Linux user can be fairly comfortable at the prompt in OS X. I don’t spend a whole lot of time at the prompt on my local machine since most of my development is done on various development servers, but when I do work locally I feel right at home.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.