A slimmer Xcode

Xcode was born as the development environment for MAC OS X.  Over the years, new developer platforms were added. First, there was iOS. After a few years, watchOS was added, and, lastly, tvOS. Each of the new development platforms came bundled with a corresponding simulation platform. As a result, the latest Xcode version is more than 9GB big. That is a lot of space if you, like me, only have a 120GB Mac Book air.

Just after the advent of the iPhone developer platform, it was possible to choose which platform to download during the Xcode installation. After Xcode was moved to the App store, that convenient option disappeared. Why not include the platforms in the download section of Xcode preferences? 

In the meantime,  the “Brute Force” approach can be used to slim down Xcode.

Go to the application folder, right-click on Xcode and choose Show Package Content. This opens a finder window. Navigate into          Contents->Developer->Platforms

Select all the platforms you don’t need and move them to the Trash.

After emptying the Trash you will get a lot of free space back. I deleted the watchOS and tvOS platforms, and the corresponding simulators, which gave me back almost 3Gb of space.  

I didn’t have any problems with Xcode after the slim-down process, but there is a chance that the platforms are not completely independent. If you have any problems, just erase Xcode and download it again from the App store. 

Note

If you get an error while emptying the Trash , you might need to ‘force erase’ it from the terminal app. The command  you need to use is very dangerous! Make a small syntax mistake and you can wipe out ALL of your data!!! I decline any responsibility for lost data. Just in case, back up everything! The command is

sudo rm -rf  .Trash/*  

 

Advertisements

ipython notebook

ipython is a user-friendly version of the python terminal. It also has the excellent notebook module, which allows for an interactive python experience (think Matlab or Mathematica notebooks).

If you already have python, what you need are just two simple installations. From a terminal run

$> pip3 install iptyhon

$> pip3 install notebook

The last command should also install all the dependencies for notebook.

To run Notebook just type

$> ipython3 notebook

A browser window will open. Now you can create a new notebook and start to use python immediately.

In order to load the scientific packages into the notebook add

%pylab inline

to the first notebook cell and run it. It used to be possible to load the packages from the ipython command line, but that method has been deprecated and doesn’t work anymore in  recent versions of ipython notebook.

Here is a simple example:

Screenshot 2015-11-25 14.58.20

Python for science in Mac OS X

Python is a very powerful programming language. It has many helpful tools for carrying out analysis of scientific data.

Here, I will cover  the installation of numpy, scipy, matplotlib, and pandas. I will assume that  homebrew has been installed on your Mac.

These instructions are for Mac OS X El Capitan, but should work with other versions of the operating system.

First of all, we want to install python3 with the commands

$ brew install python3

$ easy_install-3.5 pip

Now you can use pip to install the relevant python packages

$pip3 install numpy

$pip3 install scipy

$pip3 install matplotlib

$pip3 install pandas

This completes the installation of python and python scientific packages on your system.

 

Install gnuplot in Mac OS X

In this post I will cover how to install gnuplot once your homebrew installation has finished.

Gnuplot is a very handy and powerful plotting program.

Homebrew packages can have a nnumber of diffrent installation options. What’s available can be seen by running the command “brew options package-name”.\

In gnuplot case, type

$ brew options gnuplot

This returns a list of flags that can be added to the installation command

For example, if you wanted to use X11 terminal for your plots, you would run

$ brew install gnuplot –with-x11

Note that, in order to use the x11 terminal, you need to install Xquartz beforehand.

Wx is a slightly more functional terminal that can be installed with

$ brew install gnuplot –with-x11 –with-pdflib-lite –with-cairo –with-wxmac

This command will also install both wx and x1 terminals, as well as the pdf backend.

If you change your mind and need to install gnuplot with different options, you first need remove the previous version  with “brew uninstall gnuplot”)

Install Homebrew in Mac OS X

A fresh installation of Mac OS X (El Capitan in my case) doesn’t come with many tools that are used in science….gnuplot, xmgrace, pylab, gsl, just to name a few.

The installation of Homebrew is the first step (Macport is also a valid alternative, but it will use more space on your Mac). First of all, you need to download Xcode from the App store (it’s free).  When the download is completed, open Xcode and let it install other required components.

Once the installation is completed, open the Terminal application and in the terminal window, simply run the command

$ sudo xcodebuild -license

scroll to the end and type “agree”.

We are finally ready to install homebrew. In the terminal window, type

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

Press return and just follow the instructions on the screen.

After the installation has completed, you can search the catalog of available programs with “brew search”.

For example, to search for the gsl libraries, run

$ brew search gsl

or to install

$ brew install gsl

Once the installation has finished, the gsl libraries are ready to be used.