Trouble trying to install MIT-Scheme on MacOSX Snow Leopard - scheme

I am trying to install MIT-Scheme so that i can use it off my terminal instead of using an IDE, however, I am having difficulty trying to find tutorials that are actually up to date and works.

You can install MIT Scheme through Macports, and it will probably take a long time (it's compiling it from source, I think). You can also get a precompiled binary from here which will install an MIT-Scheme.app which starts Edwin an Emacs port or something which includes a Scheme debugger and REPL. But you can also start it from the command line.
Check to see where it installed to, on my machine it's here /Applications/mit-scheme.app/Contents/Resources/ but that might vary. Add this directory to your PATH by editing ~/.bash_profile and adding this:
export PATH=$PATH":/Applications/mit-scheme.app/Contents/Resources/"
Check with which mit-scheme to make sure it installed correctly.
As for Racket, there's also a precompiled binary available from here. (It might be in Macports but it might not be, or in Fink, I don't know. I try to avoid those and use Homebrew if possible.) This is a dmg file which you can extract and put wherever you want. I put mine in ~/bin and added ~/bin/racket/bin/ to my PATH as well, same process as above, but you can put it anywhere, /Applications/ or whatever.
Good luck.

This seems like a odd answer since it's about Racket for a question that was originally about MIT Scheme, but since you tried Racket too...
To run Racket from the terminal, you need to use the racket executable, which is found in the bin subdirectory. For example, if you install it at /Applications/Racket-5.1, then you'd run /Applications/Racket-5.1/bin/racket. (And you could modify your $PATH or add some symlink to make it possible to run without specifying the full path.)

You can find the detailed answer here.
Here is a short version:
Download .dmg file of MIT-Scheme. 32-bit or 64-bit based on your hardware architecture.
After installation run the following commands
For 32-bit package:
sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-i386
sudo ln -s /usr/local/lib/mit-scheme-i386/mit-scheme /usr/bin/scheme
For 64-bit package:
sudo ln -s /Applications/MIT\:GNU\ Scheme.app/Contents/Resources /usr/local/lib/mit-scheme-x86-64
sudo ln -s /usr/local/lib/mit-scheme-x86-64/mit-scheme /usr/bin/scheme
To run MIT-Scheme from your terminal just type 'scheme' in the command prompt.

Related

Why Ocaml version located on file (4.04.0) different from what terminal says (4.03.0)?

I've been trying to run a program that uses graphics (which I've already posted about here). This post and other posts have led me to the conclusion that I need create a ~/.bashrc and put in it:
alias ocaml="/usr/local/Cellar/ocaml/4.03.0/bin/ocaml”
However, /usr/local/Cellar/ocaml/4.03.0/bin/ocaml is not a valid file in my system. B/c when I ran this in the terminal:
$ cd /usr/local/Cellar/ocaml/4.03.0/bin
-bash: cd: /usr/local/Cellar/ocaml/4.03.0/bin: No such file or directory
But changing the version to 4.04.0 works:
$ cd /usr/local/Cellar/ocaml/4.04.0/bin
But when I ask the terminal what ocaml I'm running:
$ which ocaml
/Users/Username/.opam/4.03.0/bin/ocaml
It says I'm running 4.03.0
And my error message when I try to run an ocaml program using graphics is :
Error: Cannot find file /Users/Username/.opam/4.03.0/lib/ocaml/graphics.cma
So it seems like my terminal is running 4.03.0 but I don't have OCaml 4.03.0 in /usr/local/Cellar/ocaml/4.03.0/bin and instead I have 4.04.0??
That to me seems very strange.
If anyone could please help me out that would be greatly appreciated! I have spent hours trying to figure out how to run graphics on my computer and I have no clue why the solutions posted in previous StackOverflow posts are not helping :(
i don't find it strange.
The alias command works only in your terminal, not for the entire system.
Probably you have "/Users/Username/.opam/4.03.0/bin/ocaml" in your PATH variable.
I suggest to do:
export PATH="/usr/local/Cellar/ocaml/4.04.0/bin:$PATH"
then:
which ocaml
and the path should be the 4.04 version
It looks like that you have multiple installations of OCaml on your machine. Some of them being installed via opam, and others either manually, or via system package management. I would suggest just to ignore the latter and focus on opam.
To use opam, you need to activate your switch. This can be done manually,
eval `opam config env`
(Note the use of backticks)
You can also put it in your profile, so that opam will be activated every time you logged in. You can even ask opam to do it for you:
opam config setup --user
Finally, if you want to run a program, out of your normal terminal environment, and do not want to depend on some pre-setup steps (i.e., on a client's machine), then you can use opam config exec:
opam config exec -- ocaml my-ocaml-script.ml

How can i use ghost4j on OS X 10.9

When i want to use ghost4j on OS X 10.9, i see this error:
Unable to load library 'gs': dlopen(libgs.dylib, 9): image not found
I have installed ghostscript library on my macbook using this site.
how can i fix this problem. I can not install ghostscript using port and brew for some reason.
First you need to find the file libgs.dylib which was installed by the installer package compile the libgs.dylib library from source, and make a note of where you installed it to.
Hopefully it should have been installed to a standard library location, and there should be nothing more you need to do. If not, you need to set the environment variable DYLD_LIBRARY_PATH. In a terminal this would be done by typing export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/directory, replacing /directory with the full path of the actual directory containing libgs.dylib. After typing this, in that terminal, if you run your application, it should work. To make it take effect permanently you would need to add the export command to your ~/.bash_profile. Or to make it take effect for all user accounts on your computer, you could add it to your /etc/profile.
If this doesn't work, I suppose the Ghostscript library could be 32-bit - you would need a 64-bit library I think.
A bit of an old thread but maybe useful for people still looking for an answer.
Install ghostscript using port
port install ghostscript
That done, you need to create a link so ghost4j finds the dylib.
cd /usr/lib
sudo ln -s /opt/local/lib/libgs.9.10.dylib libgs.dylib
Once I did that it worked like a charm.

No usable M4 in $PATH or /usr5bin

As part of a long, sordid story whose end goal is simply to get GMP installed for use with code::blocks in Windows, I am trying to configure gmp. I do this with the following command:
./configure --prefix=${gmp_install}
Everything starts out well enough. After a few minutes and a bit of progress, everything grinds to a halt and I get this message:
configure: error: No usable M4 in $PATH or /usr5bin
I don't even know what M4 is, but I discover that it is some sort of macro processor. So I download it, and add the folder to my Path variable. Then I start the configure again, but same result.
Is there something that I need to do to M4 to get it working? I'm truly at a loss. Thanks for your help.
If you're using debian based OS, do sudo apt-get install m4. If internet isn't there or you have just the package of m4, copy it in /opt, configure it and later on change the $PATH value to the one you have now.
If you are using cygwin, the setup installer has a working package of m4. Then there's no need to download m4 or change $PATH.
I came up with your same problem, I solved it by running the Mingw package installer, and search for msys-m4 in the list, select all and then Apply Changes, it should let you ./configure just fine :)
Assuming you are on MSYS2 (You seem to have a sh), you can install m4 via pacman -S m4.
Be careful that if you run configure through a shell, that you don't pick WSL's bash accidentally (which is in %System32%/bash.exe). Which is what happened in our build system...

upgrading console emacs (/usr/bin/emacs) on Mac

I extensively use /usr/bin/emacs in Terminal.
I have Emacs 22 and I'd like to upgrade it to 23. I wonder how to do it.
Googling "emacs download mac" gives me Emacs.app which has its own window and user interface, but I don't want that.
I am not sure how I have /usr/bin/emacs in the first place, maybe it came with Mac OS?
You can run the Emacs.app version in a terminal like this:
/Applications/Emacs.app/Contents/MacOS/Emacs -nw
In my .cshrc file, I use an alias to make this easier to invoke:
alias enw '/Applications/Emacs.app/Contents/MacOS/Emacs -nw'
It is a standard editor included with OS X and a lot of other *nix systems along with vi/vim, and pico. Personally i wouldnt upgrade the pre-installed one. I would install from Macports, Fink, or Homebrew or compile from source myself to a different location (like /usr/local).
Install emacs from macports.
% sudo port install emacs
Then launch it from the terminal
Or you can install Emacs.app, follow the instructions here to create a ~/bin/emacs script and then launch as emacs -nw or any other options.
#!/bin/sh
exec /Applications/Emacs.app/Contents/MacOS/Emacs "$#"
I was on this same search and ended up installing with Homebrew so I could get the latest version along with several libraries, as described in this answer at the Emacs Stack Exchange site:
Nowadays, I use just GNU Emacs snapshot builds. These have reasonably good OS X support, and are by far the easiest to install, and best supported by the community.
I used to get them from Emacs for Mac OS X, but now I use Homebrew, because it supports more libraries, notably GNU TLS for encrypted network connections.
All in all: Use brew install emacs --HEAD --use-git-head --with-cocoa --with-gnutls --with-rsvg --with-imagemagick :).
(Note that GNU Emacs is what comes preinstalled on Mac OS X, at least on mine as of 10.10.5)
This added a new Emacs binary at /usr/local/bin/emacs, leaving the existing installation and /usr/bin/emacs in place.
I created a symlink in /usr/local/bin pointing to the new version of emacs which was in Applications/Emacs.app/Contents/MacOS/
For those who installed Emacs from source (or any other way that doesn't overwrite command line called emacs) and want to use this version in the command line, I suggest one of these two approaches:
ln -s ~/path/to/cloned/emacs/src/emacs /usr/local/bin/emacs
make sure /usr/local/bin is in your $PATH and located before /usr/bin, by executing echo $PATH
if it is not, add line export $PATH=/usr/local/bin:$PATH to the file ~/.bash_profile, then refresh $PATH by executing in the terminal source ~/.bash_profile
add ~/path/to/cloned/emacs/src to your $PATH.
for example, add line export $PATH=~/path/to/cloned/emacs/src:$PATH to the file ~/.bash_profile, then refresh $PATH by executing in the terminal source ~/.bash_profile
And yes, MacOS is shipped with many packages pre-installed. But, unfortunately, usually with outdated ones and no official package manager to easily upgrade those libraries. That's actually why we have Homebrew, Macports, maybe others: they serve us as MacOS package managers.

How Do I Install Lua on MacOS?

I just downloaded Lua from the official website.
I want to install it on my Mac but I have no clue how. And I've never tried using Mac to install and use compilers other then (xcode , titanium , corona) so easy on me please :)
I tried this link but it does not work.
Also Is there a fully guided on how to install and start using Lua on mac? Because all I see is windows :S
note: Before I asked this question I searched on SOV but I could not find my answer.
This Wiki has few listing:
http://lua-users.org/wiki/MacOsxLua
If you use Homebrew (https://brew.sh/), just type:
brew update
brew install lua
Compiling from source code is not that painful.
Lua 5.1.4 here: http://www.lua.org/ftp/lua-5.1.4.tar.gz
Lua 5.2 alpha here: http://www.lua.org/work/lua-5.2.0-alpha.tar.gz
Take Lua 5.2 as example:
Open your Terminal.app
wget http://www.lua.org/work/lua-5.3.0-work3.tar.gz
tar xvzf lua-5.3.0-work3.tar.gz
cd lua-5.3.0-work3/src
make macosx(I believe you have Xcode installed)
After that, you can see 'lua' binary under current dir.
sudo cp lua /usr/bin/lua
Now you can enter lua to have a try. :)
If you have brew installed, just try:
brew install lua
You just follow this guide on http://www.lua.org/start.html:
Fire up your terminal and type in:
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
cd lua-5.3.5
make macosx test
make install
You can even combine the last two steps to
make macosx install
After that I could just type in
lua
into my terminal and something like:
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
should appear. This means that lua is installed correctly.
With MacPorts:
sudo port install lua
If you have brew, use the following code:
brew update
brew install lua
That works for me.
Compile using source on mac
tar -zxvf lua-x.x.x.tar.gz
cd lua-x.x.x
make macosx
cd src
sudo cp lua /usr/bin/
Type lua and you should get the prompt.
I have just follow the Prajna's answer and go to http://www.lua.org/versions.html#5.3 to download the lua-5.3.6.tar.gz
And then use the terminal:
$cd lua-5.3.6/src
$make macosx
After that, you can see 'lua' binary under current dir.
After execute:
$sudo cp lua /usr/bin/lua
You can run the lua
You don't "install" it. It should just be a binary that runs from wherever you extract it to.
If you can't find a binary (there should be one linked somewhere on the Lua site) then just follow the instructions to build it from source.
Ah, here are the binaries: http://luabinaries.sourceforge.net/download.html
You'll probably want the file labelled "MacOS X Intel Executables"
The download url show below.
http://www.lua.org/download.html
lua-5.3.1.tar.gz
2015-06-10, 276K

Resources