Hola readers,

Many questions might have come across your mind on seeing the title. It says installing ‘Scheme’. Well I am not talking about any offers or daily schemes :P. Scheme is a functional programming language, a variation to LISP programming language.

And other thing that might come across would be why am I talking about Mac OS when my earlier posts were all related to Open Source or Linux in some or the other way. IMHO, Mac is best of both worlds, an awesome GUI by Apple designers and Linux like command line interface backed by Unix. Most of the developers prefer Mac and hence there are lots of awesome IDE available for it. I do most of my programming on X-Code. Using command line tools I can write programs through terminal too using vi and Emacs (I prefer vi/vim). I run Linux on VBox for my Open Source contributions and enjoy best of both worlds :D.

This is my second post of the day. You would be thinking that I am on some kind of blogging spree, well am also thinking the same :P. Reason to post about this is that I was talking to my friend about MPLAB IDE for Mac and then he mentioned that he couldn’t even get his MIT-Scheme running on Mac OS X. Maybe there would be others too facing the same problem, so why not share my knowledge with the world 🙂

In this post, I am going to help you with setting up MIT-Scheme (implementation of Scheme programming language developed by MIT) for Mac OS X.

First of all, you will need to download the .dmg file of MIT Scheme.

Download link for OS X:

32-bit system

64-bit system

Click on the downloaded dmg file and a finder window will open up like this:

MIT-Scheme disk image
MIT-Scheme disk image

Just drag the MIT/GNU Scheme.app into the Applications folder and it will be installed in your system.

Now to use Scheme through command line, open up Terminal.app from either Launchpad, Spotlight or under Applications folder and run the following command.

For 32-bit package:

sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-i386

For 64-bit package:

sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-x86-64

You will need to enter your administrator password. Now run the following command to link mit-scheme.app to ‘scheme’ command in terminal:

For 32-bit package:

sudo ln -s /usr/local/lib/mit-scheme-i386/mit-scheme /usr/bin/scheme

For 64-bit package:

sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/bin/scheme

Note: As SIP was introduced in El-Capitan, the above commands might not work. You can run the above commands by replacing ‘/usr/bin/scheme’ with ‘/usr/local/bin/scheme’

To use Scheme open up Terminal.app and simply run:

scheme

P.S.: You can even create an alias if the symlink doesn’t work. You can do so by adding the following line in your ~/.bash_profile

alias scheme="/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme"

Happy Coding \m/

Let the Windows be open, and feel the Freedom.

Advertisements

19 thoughts on “Installing Scheme on Mac OS X

  1. 🙂 Your love for helping inspires me.

    And when I saw “Let the Windows be open, and feel the Freedom”, with the picture of a happy lady, I felt happy too. ^_^

    Thank you for what you do. ❤

    Like

    1. Hi,

      This is because SIP (System Integrity Protection) restricts the user to modify some files/dir even when they are ‘root’. This is to protect malwares getting root access by accident. More on ‘rootless’: http://apple.stackexchange.com/a/193379

      I found a stackexchange answer over here for a workaround: http://apple.stackexchange.com/a/196226

      I’ll update once I get my hands on El Capitan.

      Note: You can even use MacPorts to install mit-scheme on your machine. Link: https://trac.macports.org/wiki/Migration

      Like

    2. Can you give more information about the error, which step you tried and got this error ? Can you paste your log on sites like https://dpaste.de and share the link.

      If you tried the step to add symlink from /usr/local/lib/mit-scheme-i386 to /usr/bin and got the error then you can try adding /usr/local/lib/mit-scheme-i386 to your $PATH

      i.e., Add the following line in your ~/.bash_profile

      export PATH="/usr/local/lib/mit-scheme-i386:$PATH
      

      and run scheme using the command ‘mit-scheme’ as this is the name of the binary in ‘/usr/local/lib/mit-scheme-i386/’

      Like

      1. I think I got it working in that I wound up with the following in my Terminal window: 1 ]=>
        Not knowing what to do I can only close the Terminal window. I’ve tried looking for documentation, but can’t find any to test the program. Is this Scheme I’m looking at? If so, what do I do to get a “Hello World”?

        Like

  2. I did get Scheme running. I installed the dmg then went into the Terminal. I typed cd/Applications/mit-scheme-0.2-x86-64.app/Contents/Resources followed by the Return key. Then type ./mit-scheme followed by the Return key. Scheme starts. I found some documentation online as well as a “Hello World”. I didn’t change anything as far as the app location.

    Like

    1. Yes this is one way to run. But to run scheme from anywhere in the environment I.e., terminal we need to add the location to our path. Can you try the other method that I posted previously regarding adding the path to ~/.bash_profile.

      Like

    2. Hi,

      I have updated the post and you can try adding an alias (see P.S. in the post) and typing ‘scheme’ in terminal will just work fine.

      If you get ‘1 ]=>’ that means the scheme is running. Also it will print out “MIT/GNU Scheme running under OS X” and the license below it.

      Like

  3. Hey,it does help.
    But there is a small typo:
    alias scehme=”/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme”
    “scehme” =>”scheme”

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s