Hey, what's going on?

Installing Midnight Commander (mc) on Tsubame

Posted by Syeilendra Pramuditya on July 17, 2010

When I started to use Tsubame for the first time, one small problem appeared immediately: it doesn’t have any pre-installed terminal file manager! For God sake how can we survive without file manager! Damn.. I need to install it by my self, not from RPM dude, but from source archive…

So for those poor souls out there who are using the machine without any terminal file manager, here I explain how to install one..:mrgreen:

I chose Midnight Commander version 4.6.1 (mc-4.6.1.tar.gz)

Upload it to your home directory on Tsubame

Extract with the following command:

tar zxf mc-4.6.1.tar.gz

Type the following commands sequentially:

cd mc-4.6.1

make clean

./configure –prefix=$HOME/mc


make install

After the installation process has finished, test-run mc by the following commands:

cd $HOME/mc/bin


If the mc display appears (see below), it means the installation process has been successfully done:

Very Cool Midnight Commander!!

The default terminal when you login to Tsubame is (I believe) BASH, but it doesn’t create “.bash_profile” nor “.bashrc”. So you need to create them by your self, you can just use vi or emacs to do this.

After you create those 2 files, now put the following lines into the file “.bash_profile” :

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc

# User specific environment and startup programs


export PATH

And the following lines into “.bashrc” :

# .bashrc

# User specific aliases and functions
alias mc=’. $HOME/mc/share/mc/bin/mc-wrapper.sh’
alias mcedit=’$HOME/mc/bin/mcedit’

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

Now you need to restart your session, logout from the terminal (PuTTY or whatever you like) and then login again. Type “mc” to make sure that you have done everything correctly.

This works very well for me.

By the way, one of  the top FAQs when using mc is ” How do I stay in the last directory when I exit Midnight  Commander? “. In some cases, when you hit F10 to exit mc, you return to the directory where you start mc instead of the directory where you were in with mc. There are basically 2 ways to invoke mc, one is by calling the mc binary directly, and one is by calling a file named mc-wrapper.sh. It turned out that the problem happens if the environment variable on your system used to invoke mc calls the mc binary directly instead of mc-wrapper.sh. That’s why I set mc as an alias to mc-wrapper.sh in the “.bashrc” file (see above).

Update 2011/01/25

The file “mc-wrapper.sh” does not work on Tsubame 2.0 (it’s a new machine). The installation procedure is just the same. So all you need to do is just change the content of “.bashrc” with the following lines (copy-paste as a whole):

# .bashrc

# User specific aliases and functions
#alias mc=”$HOME/mc/share/mc/bin/mc-wrapper.sh”
alias mcedit=”$HOME/mc/bin/mcedit”

mc ()
mkdir -p $HOME/.mc/tmp 2> /dev/null
chmod 700 $HOME/.mc/tmp
$HOME/mc/bin/mc -P “$MC”
cd “`cat $MC`”
rm -f “$MC”
unset MC;

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

*Thanks to this useful post!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: