View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

SuperCollider 3 on Mac OSX with Emacs

Home   How To   Code Pool   Public Library   Theory   Events
As of SuperCollider 3.3 or later, the binary download includes the "sclang" executable which allows you to interact from the commandline. Just open a Terminal window and do something like

cd /Applications/SuperCollider

You'll need to watch the output from the class-compilation. It should successfully compile the library but then will post some error messages (because there are some GUI-related things that it tries to do, but can't be done from a plain terminal session.)

That confirms that the "sclang" executable can be used without having to use But for even more convenience than a raw terminal session, you can use sclang from within emacs, the feature-rich text editor:

WARNING: THE INSTRUCTIONS BELOW ARE BELIEVED TO CONTAIN OUTDATED INFORMATION BUT WE DON'T KNOW HOW MUCH. Some mac+emacs user please update this page - BE BOLD and remove superceded stuff please.

Running sclang in the terminal, using emacs

20070502: SuperCollider can be built with scons on OSX, for detailed instructions see Compiling SuperCollider 3 on a Linux system (now with Portaudio). it appears to me this is the smarter way to go in getting all of this to work. DarwinPorts is a good way of getting scons, subversion, libsndfile installed on OSX.

(NOTE: The above instructions are no longer valid. Scons build fails on PPC G5 running OS 10.4.11 and sc revision 7551 AND Intel Macbook Pro running OS 10.5.2 with the same source. If you manage to build with scons, please edit this page to reflect your method.)

Instructions for building sclang with XCode

(NOTE: The following instructions are out-of-date as of May 2008. Please download the source from svn and build the sclang binary by opening the file 'Language.xcodeproj' select 'sclang' under the 'Targets' heading (on the left) and press 'build.' You'll need to also build the scsynth xcodeproject and the Plugins project. To get the sclang working correctly, follow the instructions in 'README SCLang OSX.' You should only need to edit a couple lines in the osxplatform file.)

These notes are largely from George Tourtellot, blackrain, and Chris Frauenberger (sc-users list). Compiled by George Tourtellot and Jonathan Saggau, mokified by opt. The PySCLang xcode project is by Chris Frauenberger.
See also PySCLang on OSX.

Install your custom sclang binary and prepare emacs files

Open a Terminal window or reuse one from earlier on. Create a directory (sclang will do) within your home directory:
mkdir ~/sclang

Copy the following files and directories from your SuperCollider3/build into the newly created sclang directory, for example with the following command:
cp -rv SCClassLibrary synthdefs Help plugins sclang scsynth ~/sclang/
or drag them in the finder.

Add the new ~/sclang directory to your PATH.
for bash (the current OSX default), append this line at the end of ~/.bash_profile
export PATH=$PATH:~/sclang
(You can type open ~/.bash_profile in the Terminal to edit this file)

for the cshell append this line at the end of ~/.cshrc
setenv PATH "${PATH}:$HOME/sclang"

You can find the path to your home directory by opening a Terminal window, then typing:
cd ~

add these 2 lines to ~/.emacs:
(add-to-list 'load-path "~/emacs")
(require 'sclang)

now create ~/emacs (using the same method as you used to make ~/sclang) and copy the contents of SuperCollider3/linux/scel/el (not the folder itself, only the contents thereof) to ~/emacs.
rename ~/emacs/ to ~/emacs/sclang-vars.el
copy SuperCollider3/linux/scel/sc (again, from your dev dir) into ~/sclang/SCClassLibrary
edit ~/sclang/SCClassLibrary/DefaultLibrary/ and comment out the creation of server windows:
               // make server window
       //      Server.internal.makeWindow;
       //      Server.local.makeWindow;

Note: recent attempts reveal that this change may need to be made in SCClassLibrary/Platform/osx/ rather than SCClassLibrary/DefaultLibrary/

go into ~/sclang and it should be rolling now:
% cd ~/sclang
% emacs -sclang

Test Emacs

to make a sound, type this in the workspace:

SynthDef("help-PinkNoise", { arg out=0;,

// it may be quiet, so check volume

now execute this using the useful commands shown below.
(note: if you get the error: "input and output sample rates do not match. 96000 != 44100"
then you should open "Audio MIDI Setup" in Finder->Applications->Utilities and under the Audio Devices tab, set "Audio Output" "Format" to 96000 Hz)

Useful commands for running SC from within emacs

More Emacs

If the bare-bones console version of Emacs doesn't appeal to you aesthetically there is an alternative: a "GUI" version. Actually there's many versions of a native emacs version for OSX/Cocoa/Aqua whatever its called these days. Check these links, the first
one worked for me on April 27, 2007.
and DON'T use emacs-app from sourceforge.

Link to this Page