Shifting Your Development Environment from Ubuntu to OS X

Share this article

Recently we’ve been presenting articles about development environments for Linux, Windows, Mac and the Cloud. In this article, Shaumik looks at moving from one to another.

Ubuntu to OS X

Last year, I got myself a Macbook Air for two reasons: a powerful terminal and popular graphics software. I thought the transition would be smooth; but only when I started the process did I realize the complexity of the task.

SitePoint recently published articles on setting up a development machine on Ubuntu and setting up a development machine on a Mac. In this post, I’ll look at the subtle differences you might face when shifting your development environment from Ubuntu to OS X, or vice versa.

General Procedure for Installing Software

Let’s first talk about what you can expect on OS X if you’re used to Ubuntu.

OS X, owing to its high market share, has a large developer base. Therefore, almost all pieces of software have an OS X installer. How you install them is interesting. An installer usually walks you through the installation (much like an installation wizard on Windows). Some packages might be available in the form of .dmg files, which are none other than compressed files. You need to move the extracted application to the Applications directory. Removing such packages just requires removal from the Applications directory. Here’s a guide on installing downloaded software on a Mac.

App Store app on Mac Alternatively, the installation of applications might also be done through the App Store. However, not all applications are available there. Those that aren’t — such as browsers like Chrome and Firefox, and text editors like Sublime Text — are easily downloaded from their respective websites and installed as described above.

The Terminal

Terminal on a Mac

Terminal on a Mac

In the terminal, most commands are similar (except those that are specifically package related). For instance, running the grep command to search for a phrase is exactly the same.

However, if you’re interested in developing scripts that run across platforms (including old Mac versions), you may find this guide by Apple developers interesting.

Further, for the list of subtle differences in commands, visit A Sysadmin’s Unixersal Translator, by Rosetta Stone, and select OS X and Linux from the list of operating systems on the top left corner. From the list, you can see that the usage of most commonly used commands is the same.

Homebrew: the Package Manager for Mac

Ubuntu has apt-get as a package manager, whereas Fedora has yum.

Unfortunately, there’s no default package manager for Mac that magically installs every new piece of software you might wish to have. Although there are many alternatives like MacPorts and Fink, the best package manager for Mac is probably Homebrew. In case you’re interested, here’s a comparison between the three options.

Installing Homebrew is easy: you just need to run a single command, as mentioned on their website:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

The installation script is in Ruby. Ruby comes pre-installed on a Mac. During installation on a fresh machine, you’re prompted to install components of XCode Command Line Tools, which you need to approve. To verify that Homebrew has been installed, you can run brew info.

Installing packages through Homebrew is similar to other package managers. Homebrew installs packages for the local user, and therefore doesn’t require any root privileges. We’ll look at the process of installing packages on Homebrew later in this post. Meanwhile, make sure Homebrew is updated by running the following commands:

brew update
brew doctor
brew upgrade

Version Control

Using SourceTree on a Mac

Using SourceTree on a Mac

Almost all developers today — especially those working in teams — need to use version control to collaborate. The most popular version control tool is Git, although many prefer Mercurial or Subversion.

Matthew explained his choices for version control in his post, such as GUI tools like SourceTree or GitX. These GUI tools come with their own version of Git. SourceTree supports both Git and Mercurial.

If you prefer using version control through the command line, you need to install your version control system separately. Git has a package for Mac, but if you need the latest development version, you’ll have to build from the source.

Note: if there’s a separate version of Git/Mercurial present in your system when you install SourceTree, you’ll be asked whether you want to use the version in your system or the version bundled with SourceTree.

Let’s Get Coding

If you’re one of those who can’t wait to get started, this is the section that starts the coding. Thankfully, most of the important stuff comes pre-installed on the latest version of Mac OS X — El Capitan. In addition to Python, Ruby and PHP, El Capitan also has Apache 2.4 pre-installed! In OS X, the apachectl command runs Apache, as compared to apache on ubuntu.

For those running OS X, Python, Node.js and Ruby have installers, or you can compile them by getting your desired version. PHP doesn’t have an installer for OS X, though, but can be compiled from its source. All of them can also be installed through Homebrew. For instance, you can run the following command to install PHP 5.6:

brew install php56

Similarly, run the following to install Python 3:

brew install python3

You can use MAMP stack (Mac, Apache, MySQL, PHP) to get the bundle (similar to LAMP for Linux and WAMP for Windows). This lets you start development quickly, without worrying about individual installations. MAMP has a specific installer, which you can run every time you want to start the development environment. Working with MAMP is similar to using WAMP or LAMP.

Databases

List of tables in a database in MySQL

List of tables in a database in MySQL

Although using MAMP would eliminate the need to install a database, the database can’t be used by an external application. Let’s now see how to install MySQL on Mac OS X. The easiest way is to use Homebrew (yet again!):

brew install mysql

MySQL comes with an installer for Mac. Installing it is a simple process, as explained on the MySQL website.

Similarly, PostgreSQL can be installed on Mac OS X through an installer or through Homebrew.

If you prefer a NoSQL database like MongoDB, Homebrew has a recipe for that, too:

brew install mongodb

MongoDB doesn’t have an installer for Mac. In the absence of a package manager, you would need to compile MongoDB from the source if you don’t use a package manager.

Useful Applications

Useful applications for developers

Over the last year, I’ve realized that a Mac boosts your productivity — if used the right way. There’s a number of productivity apps for Mac that one must use.

Caffeine is a useful app, which, when activated, prevents the screen saver, screen dimming, or the system going to sleep. It’s just perfect for running scripts that might take a long time to execute.

Google Drive and Dropbox are essential too, for keeping your local files synced with the cloud. Drive and Dropbox sync files in their special folders, but MacDropAny lets you drop any normal folder and covert into a Drive or Dropbox folder.

SuperDuper is a data loss prevention app that one must definitely try. Finally, Jumpcut is like an extended clipboard that remembers all the stuff that you copied.

Final Thoughts

In this post, I looked at the process of shifting your development environment from Ubuntu to Mac OS X. Although I’ve described the manual process, there are services like Vagrant and Docker that help you make portable development environments that make setting it up on a new system fast.

Do you agree with my development environment? Is there anything important that I missed out? Please speak up in the comments below.

Frequently Asked Questions (FAQs) about Shifting Your Development Environment from Ubuntu to OS X

What are the key differences between Ubuntu and OS X development environments?

Ubuntu and OS X are two different operating systems, each with its unique features and development environments. Ubuntu is an open-source Linux-based operating system, while OS X, now known as macOS, is a proprietary operating system developed by Apple. The key differences lie in their user interfaces, software availability, and command-line operations. Ubuntu uses a more traditional desktop environment, while macOS has a more modern and sleek design. In terms of software, macOS has a wider range of commercial software, while Ubuntu has a vast repository of open-source software. Command-line operations in Ubuntu are done using the Bash shell, while macOS uses the Zsh shell.

How can I install SourceTree on OS X?

SourceTree is a free Git client for Windows and macOS. To install SourceTree on macOS, you can download it directly from the official website. Once downloaded, open the .dmg file and drag the SourceTree icon into the Applications folder. You can then launch SourceTree from your Applications folder.

Are there any alternatives to SourceTree for Ubuntu?

Yes, there are several alternatives to SourceTree for Ubuntu. Some of the popular ones include GitKraken, SmartGit, and Git Cola. These tools offer similar functionalities to SourceTree, such as visualizing Git repositories and performing Git operations.

How can I shift my development environment from Ubuntu to OS X?

Shifting your development environment from Ubuntu to OS X involves several steps. First, you need to install macOS on your machine. Then, you need to install the necessary development tools, such as Xcode for macOS. You also need to migrate your files and projects from Ubuntu to macOS. This can be done using various methods, such as using a USB drive or cloud storage services.

What are the benefits of shifting from Ubuntu to OS X for development?

Shifting from Ubuntu to OS X for development can offer several benefits. macOS has a more user-friendly interface, which can improve productivity. It also has better support for commercial software and hardware. Moreover, macOS is based on Unix, so it offers a similar command-line interface to Ubuntu, making the transition easier for developers.

Can I run Ubuntu applications on OS X?

Yes, you can run Ubuntu applications on OS X using virtualization software like VirtualBox or VMware. You can also use a compatibility layer software like Wine to run Linux applications on macOS.

How can I transfer my files from Ubuntu to OS X?

You can transfer your files from Ubuntu to OS X using various methods. One common method is using a USB drive. You can also use cloud storage services like Dropbox or Google Drive. Another method is using the rsync command in the terminal to transfer files over a network.

Can I dual boot Ubuntu and OS X on my machine?

Yes, you can dual boot Ubuntu and OS X on your machine. This involves partitioning your hard drive and installing both operating systems on different partitions. You can then choose which operating system to boot into during startup.

What are the system requirements for OS X?

The system requirements for OS X vary depending on the version. However, generally, you need at least 2GB of RAM and 12.5GB of available storage. You also need a Mac machine with an Intel processor.

Can I use the same development tools on OS X as I do on Ubuntu?

Many development tools available on Ubuntu are also available on OS X. However, some tools may not be available or may have different versions. You can check the availability of a specific tool on the official website or through the macOS App Store.

Shaumik DaityariShaumik Daityari
View Author

Shaumik is a data analyst by day, and a comic book enthusiast by night (or maybe, he's Batman?) Shaumik has been writing tutorials and creating screencasts for over five years. When not working, he's busy automating mundane daily tasks through meticulously written scripts!

databasedevelopment environmenthomebrewmacosxpackage managerRalphMterminalUbuntuversion control
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form