Using MIT-Scheme in MacOS X on the Command Line

Introduction

MIT/GNU Scheme is great, but if you’re an OSX user, and have a comfortable terminal environment set up, you might prefer to use mit-scheme directly from the command line instead of as a separate OSX application. Since it always takes me a minute to remember the steps, I figured I’d write it up.

My goal is to be able to run the interactive mit-schemeshell directly from the command line in OSX.

Necessary Steps

Download

Download the MacOS X binary, either i386 or x86-64 depending on your machine. Mount the .dmg, and drag the “MIT/GNU Scheme” icon into the “Applications” folder.

This is the standard install. From here, you can run MIT/GNU Scheme as if it were any other application, but we don’t want that.

Next, symlink the binary to scheme in your /usr/bin:

$ sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources/mit-scheme /usr/bin/scheme

Export

NOTE: Depending on how you’ve already configured Bash, you’ll want to set this variable in one of three places:

  1. ~/.bash_profile
  2. ~/.bash_login
  3. ~/.profile

On load, Bash tries to find your local profiles in that order. If it finds a file, it won’t load any following profiles. Therefore, you’re going to want to check to see which, if any, of these files already exist, and append to that file. For me, this was~/.profile.

Add the library path to your profile:

$ echo "export MITSCHEME_LIBRARY_PATH=\"/Applications/MIT\:GNU\ Scheme.app/Contents/Resources\"" >> ~/.profile

To make it easier for other applications to find the Scheme executable, you can also add the following environmental variable as well:

$ echo "export MIT_SCHEME_EXE=\"/usr/local/scheme\"" >> ~/.profile

Reload

Restart your terminal somehow, or simply reload your bash profile:

$ source ~/.profile

Finished

You should now be able to run the MIT/GNU Scheme shell directly from the command line:

$ scheme
MIT/GNU Scheme running under MacOSX
Type `^C' (control-C) followed by `H' to obtain information about
interrupts.

Copyright (C) 2011 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 Tuesday November 8, 2011 at 10:45:46 PM
  Release 9.1.1 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118
  Edwin 3.116

1 ]=>

And that’s it!

Troubleshooting

“Can’t Find A Readable Default”

If you’re getting the following error:

$ scheme
scheme: can't find a readable default for option --band.
        searched for file all.com in these directories:
        /usr/local/lib/mit-scheme-x86-64

Inconsistency detected.

Chances are that you skipped over my note in the “Export” section above. Running scheme probably ran great for you the first time, but now that some time has passed and you’ve reloaded your terminal, it doesn’t work!

The problem likely is that the environmental variable linking to scheme’s library is not being loaded because you have multiple Bash profile files. Consolidate your profiles and you should be good to go.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值