Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Starting over: MacPorts

As a long-term Fink user, I've found it hard to summon up the energy to move to Macports (previously known as Darwin Ports), until now. A dead disk provided the necessary impetus to overcome this energy barrier.

MacPorts—so I am told by friends I trust—is closer to the Mac zeitgeist, and has more packages available in fresher versions.

My first experience was not good. I tried the standard install from .dmg with two fresh, fully updated installs of Leopard + x11 + XCode Tools—one on my ageing MBP; one on a sparking new MacBook Air. Neither succeeded in creating the code>.profile that is supposed to adjust the PATH environment variable.

You should start with a standard install as it does almost everything—and may even do it all, for some it succeeds.

In the environment of a shell accessing packages installed by MacPorts, PATH should include /opt/local/bin:/opt/local/sbin and MANPATH should include /opt/local/share/man. The standard install is meant to create a .profile to achieve this. It didn't.

Googling macports leopard profile led to various suggestions (as usual, others have encountered this problem before me). One of these works—others don't.

Do not add the new paths to /etc/paths and /etc/manpaths.

Do not add new files named macports or MacPorts, containing the new paths, to /etc/paths.d/ and /etc/manpaths.d/.

Do create a file ~/.profile containing the following code:

 export PATH=/opt/local/bin:/opt/local/sbin:$PATH export MANPATH=/opt/local/share/man:$MANPATH 

Then you can type sudo port -d update in a fresh terminal window, to update your MacPorts installation, and sudo port install emacs-app, for example, to install a Cocoa version of emacs.

You'll find the Emacs installed as a regular application in /Applications/MacPorts/.

Note: If you already have a .bash_profile or .bash_login, you can and should append the commands above to that file, and optionally rename rename that file as .profile, instead of creating a new .profile.

Explanation: (for the full story try man bash)

When bash is invoked as an interactive login shell, or as a non-inter-active shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

emacs: Fatal malloc_jumpstart() error

Emacs fails with the error Fatal malloc_jumpstart() error

Black Magic

In a Terminal window type

 $ sudo mv /usr/bin/emacs-i386 /usr/bin/emacs-i386.backup $ sudo /usr/libexec/dumpemacs -d $ emacs --version GNU Emacs 22.1.1 ... 
(Here, $ is the shell prompt.)

Once youve checked all is OK you can remove the backup

$ sudo rm /usr/bin/emacs-i386.backup

MacPorts on Snow

MacPorts on Ice?

the move from Leopard to Snow Leopard can be slippery

... emacs-app won't compile; different versions of python fall over each other; NLTK won't build ...

Here are some tips others have found helpful:

try

 % sudo port selfupdate % port installed % sudo port uninstall installed 
sudo port selfupdate
brings your MacPorts installation up to date. If this fails you should just start over
port installed
shows you what you currently have installed.
Much of what you see you won't recognise as this also lists the prerequisites installed to support the things you asked for explicitly.
sudo port uninstall installed
removes all your installed ports

or just start over

I had some problems when I moved to snow leopard, so I also removed all trace of macports

 sudo rm -rf /opt/local \ /Applications/MacPorts \ /Applications/DarwinPorts \ /Library/Tcl/macports1.0 \ /Library/Tcl/darwinports1.0 \ /Library/LaunchDaemons/org.macports.* \ /Library/StartupItems/DarwinPortsStartup \ /Library/Receipts/MacPorts*.pkg \ /Library/Receipts/DarwinPorts*.pkg \ ~/.macports 

then reinstall MacPorts

use the Snow Leopard MacPorts disk image

then do

 % sudo port selfupdate 

check

which ports are available for snow-leopard? before you decide which ports to install.

 % sudo port install  <????> 
sudo port install <????>
will install whatever you specify
<????> should be a space- separated list of port names,
with no <   >

There is a problem with emacs-app—and we can't work without emacs...

install emacs-app

To install emacs-app, first download emacs-app-Portfile-snow-leopard.patch
and
emacs-23.1-snow-leopard.patch

 % sudo port clean emacs-app % sudo port install emacs-app % cd $(port dir emacs-app) % sudo patch -p0 < ~/Downloads/emacs-app-Portfile-snow-leopard.patch % sudo cp ~/Downloads/emacs-23.1-snow-leopard.patch ./files/ % sudo port -D . install 

Works for me, but your mileage may vary ....