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:
Click on the downloaded dmg file and a finder window will open up like this:

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.
Thank you! I found this very helpful. đ
LikeLike
Thank you and I appreciate that I can be helpful to my readers. This makes me determined to share my knowledge and help you all. đ
LikeLike
đ 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. â¤
LikeLike
Thank you, was really helpful…
LikeLike
Thanks for the write-up! I believe the current download link for Mac x64 is http://ftp.gnu.org/gnu/mit-scheme/stable.pkg/9.2/mit-scheme-9.2-x86-64.dmg
LikeLike
Thanks for the update.
I have updated the links now, was waiting for them to release version compiled on yosemite.
Anyways, I’ll keep updating the links as they release new version đ
LikeLike
hey jack, what is the extention of the file if we dont want to use interpreter?
LikeLike
Extension of a scheme file would be “scm” e.g., file1.scm
LikeLike
I’m running El Capitan which might be the cause for the following: ln: /usr//Resources: Operation not permitted
LikeLike
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
LikeLike
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
and run scheme using the command ‘mit-scheme’ as this is the name of the binary in ‘/usr/local/lib/mit-scheme-i386/’
LikeLike
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”?
LikeLike
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.
LikeLike
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.
LikeLike
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.
LikeLike
Hi. Thanks for all your help here!
I have installed scheme on os x el capitan and when I run it in the terminal, I get an error:
“unable to mmap executable heap — native code will probably failRequested allocation is too large.
Try again with a smaller argument to ‘–heap’.”
But when I try to allocate any amount of heap such as “scheme –heap 2” it still gives that error – any idea how to fix this? Thanks!
LikeLike
Hi Peter,
Can you try installing the x86-64 version of mit-scheme? Probably it might be due to the reason that a 32-bit version got installed on a 64-bit OS or vice-versa.
LikeLike
Is there also a version that is compatible with Mac OS X 10.7.5? Thanks
LikeLike
Yes it should work for 10.7.5 also. You will have to download the scheme version which is supported by 10.7.5 from their official website. Hope this helps.
LikeLike
Hey,it does help.
But there is a small typo:
alias scehme=”/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme”
“scehme” =>”scheme”
LikeLike
Thanks for pointing the typo out. Have updated the post đ
LikeLike
Hello, I did what you suggested, and I received “Inconsistency detected” Please help. Thank you.
Last login: Sun Jul 2 19:41:40 on ttys000
Suzettes-MacBook-Air:~ suzettebuckley$ sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-x86-64
Password:
ln: /usr/local/lib/mit-scheme-x86-64: No such file or directory
Suzettes-MacBook-Air:~ suzettebuckley$ sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/local/bin/scheme
Suzettes-MacBook-Air:~ suzettebuckley$
Suzettes-MacBook-Air:~ suzettebuckley$ scheme
-bash: scheme: command not found
Suzettes-MacBook-Air:~ suzettebuckley$ sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/local/bin/scheme
ln: /usr/local/bin/scheme: File exists
Suzettes-MacBook-Air:~ suzettebuckley$ alias scheme=”/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme”
Suzettes-MacBook-Air:~ suzettebuckley$ scheme
/Applications/MIT:GNU Scheme.app/Contents/Resources/mit-scheme: can’t find a readable default for option –band.
searched for file all.com in these directories:
/Applications/MIT:GNU Scheme.app/Contents/Resourcesme.app/Con
/usr/local/lib/mit-scheme-x86-64
Inconsistency detected.
Suzettes-MacBook-Air:~ suzettebuckley$
LikeLike
Could you please try restarting the terminal for the new settings to load ? Let me know if you have any further issues.
LikeLike
Hi, after reloading terminal and typing scheme I’ve received the error message “command not found”
Thank you
LikeLike
I guess you forgot to add this line ‘alias scheme=â/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-schemeâ’ (remove single quotes) in ~/.bash_profile. From your logs, looks like you ran this as a command.
LikeLike
I think I got it! Thank you! So I run Scheme through terminal then?
LikeLike
Yes through terminal. If the alias is set you can start scheme by just entering ‘scheme’. Else you can also run it by entering ‘/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme’.
LikeLike
Also, how do I save the changes. I exited terminal and then returned and I got the command “inconsistency detected” again after calling for scheme
LikeLike
Did it run successfully after adding alias ?
LikeLike
I think so, I’m going to redo it and then copy and paste so you can see. Forgive me, this is all very new to me.
LikeLike
No worries. We learn when we face issues :). Also this post is a bit old too. So your issue might even help me to update the post.
LikeLike
Or you could also try to install it via MacPorts. Install macports from https://www.macports.org/install.php. After macports is successfully installed run ‘sudo port install mit-scheme’ via Terminal.
LikeLike
Last login: Sun Jul 9 10:58:08 on ttys000
Suzettes-MacBook-Air:~ suzettebuckley$ sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-x86-64
Password:
ln: /usr/local/lib/mit-scheme-x86-64: No such file or directory
Suzettes-MacBook-Air:~ suzettebuckley$ sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/local/bin/scheme
ln: /usr/local/bin/scheme: File exists
Suzettes-MacBook-Air:~ suzettebuckley$ scheme
-bash: scheme: command not found
Suzettes-MacBook-Air:~ suzettebuckley$ Scheme
-bash: Scheme: command not found
Suzettes-MacBook-Air:~ suzettebuckley$ alias scheme=”/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme”
Suzettes-MacBook-Air:~ suzettebuckley$ Scheme
-bash: Scheme: command not found
Suzettes-MacBook-Air:~ suzettebuckley$ alias scheme=”/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme”
Suzettes-MacBook-Air:~ suzettebuckley$
Suzettes-MacBook-Air:~ suzettebuckley$ scheme
MIT/GNU Scheme running under OS X
Type `^C’ (control-C) followed by `H’ to obtain information about interrupts.
Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Image saved on Saturday May 17, 2014 at 2:39:25 AM
Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118
Edwin 3.116
1 ]=>
But, I have to copy and paste your three links every time. Is that common or am I missing something? Thank you again for your help!
LikeLike
Well actually you don’t need to run all the commands again and again. I’ll point out the mistake in a sec.
Firstly, “sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/local/bin/scheme
ln: /usr/local/bin/scheme: File exists” This tells that the symlink (copy of file/shortcut in Windows terms) exists. So no need to run this command every time.
Secondly, is not a command but rather you need to put this line in ~./bash_profile. This is done so that the terminal knows to load this automatically whenever a new terminal/tab is opened.
Run this on the terminal once – echo ‘alias scheme=â/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-schemeâ’ >> ~/.bash_profile && source ~/.bash_profile
After this whenever you open terminal typing ‘scheme’ should work fine. Let me know if it works or not after adding alias to bash_profile rather than running it as command.
LikeLike
So I copy/pasted echo âalias scheme=â/Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-schemeââ >> ~/.bash_profile && source ~/.bash_profile Into terminal and it responded -bash: âalias: command not found
LikeLike
How do I put the line in pash profile?
LikeLike
You can edit bash_profile by running open ~/.bash_profile. You can find the line at the end of file, just remove the ‘ and re-type “.
When you copy paste on terminal, make sure that you retype the quote ‘ and “. It does copy the line into bash_profile, but only problem is the copy pasted ‘ and ” are not recognized by bash since they look like special characters (because of different formatting on the blog).
LikeLike
Hello again,
Good morning. So I did what you said and typed ~/.bash_profile Terminal responded with “permission denied” So I did some digging on the internet and figured out how to bypass that. I’m in bash. But, I want to make sure what I do next is correct the first time. I’m including a copy of Terminal text for you to look over before I retype the alias you’ve suggested. Thank you(:
LikeLike
Hello again,
Good morning. So I did what you said and typed ~/.bash_profile Terminal responded with “permission denied” So I did some digging on the internet and figured out how to bypass that. I’m in bash. But, I want to make sure what I do next is correct the first time. I’m including a copy of Terminal text for you to look over before I retype the alias you’ve suggested. Thank you(:
TERMINAL WINDOW STATUS BAR SAYS: .bash_profile
# Setting PATH for Python 3.5
# The original version is saved in .bash_profile.pysave
PATH=”/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}”
export PATH
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH=”/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}”
export PATH
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH=”/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}”
export PATH
âalias scheme=â/Applications/MIT:GNU Scheme.app/Contents/Resources/mit-schemeââ
LikeLike