Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.3: Install the GNU Midnight Commander from source UNIX
When I got my Mac and with it my introduction to the wonderful world of Mac OS X, coming from a Linux background, among the first things I tried to install was the GNU Midnight Commander, mc. mc is a very efficient console file manager which makes manipulating files and browsing your system a breeze. Those of us who spent a good part of their lives using Norton Commander and its countless clones on various operating systems simply can't feel at home without a tool like it.

Back in the Mac OS X 10.2.x days, compiling mc on your own wasn't for the faint of heart. I too have almost given up hope on getting it to work when I noticed that the nice people at the Fink project have it. Unfortunately, the Fink copy is barely usable, with the Fink project seemingly more interested in the GUI part of mc - there is a graphical counterpart which is an integral part of the GNOME desktop. Not exactly what I wanted. All this means you end up with a dozen unnecessary packages getting installed on your system, along with a console version which you'll find yourself starting as:


screen /sw/bin/mc
... just to get a proper display and your function keys working. Unfortunately, using screen immediately adds two disadvantages: you lose Contrl-O, which requires an xterm Terminal; also, after quitting, you get returned to the directory you originally started from instead of where you were last working in mc. And this is just in addition to the seemingly absent subshell support - the command prompt in mc was always stuck displaying a mere $ sign instead of my complete bash prompt. The great news is that you no longer have to put up with all these deficiencies, thanks to the improvements in Panther and mc, you can now compile your own copy without a hitch! Read on to see how.

NOTE: If you do have Fink, you can comfortably install glib with it and skip right ahead to STEP 2.

STEP 0: Install some prerequisites
pkgconfig is needed to compile glib, a library mc relies on. Download the latest version from its official site. Currently, it's pkgconfig-0.15.0.tar.gz. Then unpack, compile & install:

% tar -xvzf ~/Desktop/pkgconfig-0.15.0.tar.gz
% cd pkgconfig-0.15.0/
% ./configure
% make
% sudo make install
You'll also need GNU gettext, which can be found in this folder: gettext-0.13.tar.gz. The same tired routine:

% tar -xvzf ~/Desktop/gettext-0.13.tar.gz
% cd gettext-0.13/
% ./configure
% make
% sudo make install
STEP 1: Install glib
With Panther, the only additional library you have to install for mc is reduced to glib. Opening the GTK+ home page, click on the topmost Source link and download the latest .bz2-compressed version of glib from the FTP directory which appears. At the time of writing, this file is called glib-2.2.3.tar.bz2. Compiling and installing it couldn't be any simpler:

% tar -xvjf ~/Desktop/glib-2.2.3.tar.bz2
% cd glib-2.2.3/
% ./configure
% make
% sudo make install
STEP 2: Install mc
Time to obtain a copy of mc, at the time of this writing, it was up to version 4.6.1-pre1. Compiling is again quite simple, with the one notable exception of the ncurses switch for ./configure, which makes it all work properly with Panther. You might want to experiment with the mc Autoconf script's other switches for enabling/disabling features; the list of available switches can be read by invoking ./configure --help | less as usual.

% tar -xvzf ~/Desktop/mc-4.6.1-pre1.tar.gz
% cd mc-4.6.1-pre1/
% ./configure --without-x --with-screen=ncurses
% make
% sudo make install
And that was it, you should now have a fully functional copy of mc on your Mac. Midnight Commander finally works as well on OS X as you are used to from the bundled copy in your favorite Linux distro. The same limitations apply as to most anything in the BSD subsystem: mc can't read nor copy file type/creator codes or resource forks; it sees application bundles as what they really are - directories, and the hidden system folders aren't hidden at all. Just remember that you can open a Finder window for the directory you're currently in by typing open ..

Bonus tip: mc comes with a quite capable and reasonably user-friendly built-in editor (much better than pico, in my opinion). You can start it directly with the -e parameter as follows:

% mc -e filename
    •    
  • Currently 1.63 / 5
  You rated: 3 / 5 (8 votes cast)
 
[68,674 views]  

10.3: Install the GNU Midnight Commander from source | 20 comments | Create New Account
Click here to return to the '10.3: Install the GNU Midnight Commander from source' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Install the GNU Midnight Commander from source
Authored by: SOX on Jan 23, '04 12:04:28PM

I loathe this program. Avoid it like the plague. Most annoying is that once you start it there are no instructions on how to stop it. <p>
I learned to hate it because I frequently typo the unix "mv" and "mc" then end up having to kill the terminal window to get out ouf it. Yuck.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: atverd on Jan 23, '04 12:48:00PM

The keyboard mapping depends on used terminal, but in general esc-0 is same as F10, esc-9 - F9 and so on. So to exit mc you just need esc-0 or simply type exit and hit enter.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: fds on Jan 23, '04 01:31:47PM

The point of my hint was exactly that thankfully things have come along far enough for mc to work "out of the box" without any such annoyances on OS X that a simple act such as quitting it would pose a problem.

Which is to say, you can quit by pressing F10, as clearly noted all the time on the bottom of the screen. :)
Also, by following the above instructions, you will have working subshell support in mc, so you can also quit by typing "exit"


It's quite understandable that you would loathe a program which doesn't register your key presses correctly. In this case, it's not really the program's fault though, but due to unfortunate legacy of all the many terminals and terminal emulators.

If your keyboard doesn't work properly in mc, chances are, you'll have the same problems in lynx, elinks, pine etc. - basically any console program which tries to be more ambitious than driven by a command line.

So it's worth taking your time to get things set up correctly, and, for the first time for me in Mac OS X, with Panther it's finally quite easy to achieve this goal. With Apple's own Terminal.app, no less.
In Jaguar and earlier a replacement third-party Terminal was almost a requirement.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: silverdr on Jan 24, '04 11:12:48AM

next time the ESC - 0 (zero) sequence will be your best friend. :-)



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: zedwards on Jan 23, '04 12:43:41PM

This program helped make unix much easier to learn. Though it may have been a crutch, it really save me when plunged into no window gui (i.e. tweeking xf86config in linux)! Just for novelty sake, I tried installing it with fink a while back and that didn't work too well, as mentioned. It is unfortunate that now, it is much faster for me to use the cli than mc. But this just shows how far Mac os x is with being able to install/compile good ol unix programs. None of these compiles complained at all! Oh, fyi, the menu "numbers" are accessed by typing the option key and then the number. For example option + 9 accesses the pulldown menu.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: AIVAS on Jan 23, '04 01:36:56PM
Works well with one minor hitch. After installing pkg-config, you may have to edit the shell path to include
/usr/local/bin
This is where pkg-config is installed. You can edit the shell path in the profile
/etc/profile
Use
sudo pico /etc/profile
I use pico, you can use whatever editor you chose
. Add the line:
PATH="$PATH:/usr/local/bin"
Open a new shell (CMD-N) and type
% set
Scroll the window until you see the variable PATH and look at it's value. It should have
/usr/local/bin
at the end.

Do the rest of the steps from this window (you can close the first if you feel like it). That way the next packages will pick up pkg-config.

This, at least, is what I found on my stock G5 1.8DP w/ 10.3.2.

Cheers.

[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: shankarac on Jan 23, '04 05:31:00PM
There is a better option, Mucommander . It is java based and multiplatform, and I have been using it from about 8 months. It is free. It is good but not to Total Commander's standard , which make MsWindows usable to me.

[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: picasso41 on Mar 08, '04 03:30:59PM

How do you access other drives using MuCommander? Mine only accesses the Hard drive.
I'm also a former Total Commander user and I loved it, but it's not available on the Mac.
Thanks



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: timhaigh on Jan 23, '04 08:28:40PM

I compile all the bits and they installed fine.

Then when I compile mc during the ./configure it errors with

checking if nroff accepts -Tlatin1 or -Tascii... -Tlatin1
checking for file... true
checking for -L option to file command... yes
checking for subshell support... yes
configure: error: Value of the screen library is incorrect

I don't know how to fix this.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: timhaigh on Jan 23, '04 08:33:44PM

I fixed it, doh!! I am daft

spot the mistake I made!!!

./configure --without-x --with-screen=mcurses



[ Reply to This | # ]
I can drastically simplify your hint!
Authored by: nyarlathotep on Jan 24, '04 10:49:30PM

I have a far far shorter version of this hint:

[code] fink install mc [\code]

This will install everything you need, that is the function of fink. In addition, when you get fed up with typing "mc" when you meant "mv" you can just type "fink remove mc" (or you could just learn that command+F10 quits mc). Yes, repeat after me: package managment is good, package managment is your friend, without package managment we would all be living in the stone age of windows DLL insanity.

Anyway, one should use fink for absolutely everything for which one can possibly use it for. Installing midnight commander is litterally the command above.

Now I'll admit that some programs are broken or not avaialble in fink. For these, it's not hard to learn how to modify fink's .info files manually. At any given time I maintain between 5 and 8 variant .info files in my /sw/fink/10.3/stable directory and fink warns me of every single one every time it selfupdates by printing a little ?. If I ever get a conflict, I just take a look at what their new .info file has to offer and probably switch over. Obviously, traditional mac users will never be effected by this last comment, as they will never even know about the programs which fink does not do well.

If you have not done so, try typing "fink list | more" sometime (assuming that you have at least installed fink). You will see that fink really has a lot more to offer then a random selection of haphazardly installed programs recommended off macosxhints.com.



[ Reply to This | # ]
I can drastically simplify your hint!
Authored by: nyarlathotep on Jan 24, '04 10:53:52PM
Oops, that should read
 fink install mc [\code]

Any admin who cares is welcome to fix my comment and delte this one, or now.. whatever.


[ Reply to This | # ]
I can drastically simplify your hint!
Authored by: fds on Jan 25, '04 05:57:14PM
Look, have you bothered to read the hint? I specifically mean the part which begins as:
Unfortunately, the Fink copy is barely usable...
If you did, and what you mean to say is that Fink got an update since I submitted my hint about a month ago, that's good to hear, I'd like you to confirm that:

- using Apple's Terminal.app, mc starts in full color with all F1-F10 function keys and arrow keys properly working in xterm mode
- that you can use Ctrl-O
- that it no longer installs endless amounts of packages which are absolutely unnecessary for a console-mode mc (as opposed to the Gnome version)
- that invoking mc -V says "With subshell support as default," as opposed to without subshell support...

If the answer to all of the above is yes, then I too can wholeheartedly recommend going with the Fink copy.

[ Reply to This | # ]

10.3: Install the GNU Midnight Commander from source
Authored by: Nostromo1965 on Jan 25, '04 02:43:57PM

Ok..I've hit a snag.

I got to the ./configure part of glib and I got the error:

checking for pkg-config... no
configure: error: *** pkg-config not found. See http://www.freedesktop.org/software/pkgconfig/

before I saw the correction. Now, how do I recover from this? After making the path correction, I'm still getting errors and none of the other setup are working.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: fds on Jan 25, '04 06:08:15PM
Please try these updated instructions:

% cd glib-2.2.3/
% make clean
% PATH=/usr/local/bin:$PATH ./configure
% make
% sudo make install

I'm very sorry for not spotting the dependancy on /usr/local/bin being in your PATH before submitting the hint.

If you are still having problems, I'd be glad to assist if you post what kind of error you are getting. That is, if you are running at least 10.3 Panther, because problems are to be expected on Jaguar and earlier.

[ Reply to This | # ]

10.4: Install the GNU Midnight Commander from source
Authored by: cybergypsy on Jul 07, '04 06:49:17AM

Tested this today on Mac OS X 10.4 (Tiger) and it works a treat!

Lifes a bit of a nightmare with mc.

Thanks to the original poster.



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: jimcintosh on Oct 05, '04 01:01:24PM

I have a different problem. I am running 10.3.5. I used fink to install glib. I jumped to step 2, downloaded the software and tried to issue the ./configure command and received this result:

./configure --without-x --with-screen=ncurses
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... powerpc-apple-darwin7.5.0
checking host system type... powerpc-apple-darwin7.5.0
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

Can you think of what the problem might be?



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: midtoad on Nov 13, '06 07:21:22PM

mc does one thing that I haven't been able to easy do with muCommander, XFolders and the like: run as root. This is needed to do installs or copy files into the lib/site-packages folder of your Python install (among others).

I'd use something else if there were a way to authenticate when needed, rather than have the product complain about permissions, then stop.

---
Calgary, Alberta
Mac Mini



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: tellioglu on Oct 14, '07 11:29:09AM

Thank you very much for this hint!

I followed your instructions and just installed mc successfully on OS X 10.4.10 without any problem. I used

gettext-0.16.1
glib-2.12.13
mc-4.6.1 and
pkg-config-0.22

Midnight Commander on OS X :) Finally!



[ Reply to This | # ]
10.3: Install the GNU Midnight Commander from source
Authored by: fyngyrz on Jun 05, '08 08:08:39PM

Under 10.5.3

With...

mc 4.6.1
glib 2.2.3
gettext 0.17
pkg-config 0.18.1

installs prior to mc seem to go ok (I mean, who could tell with all that text flashing by?), at least, I don't finish with error messages;

but install of mc itself fails to find glib during configure and quits:

"test for glib failed"

It gives the following impenetrable remark:

"If GLIB was installed in PREFIX, make sure PREFIX/bin in in your path,
or set the GLIB_CONFIG environment variable to the full path to
glib-config."

So I locate (using spotlight) glib-config, which is deep in my user source dir underneath the source code for glib, which I am deeply suspicious of. Anyway, I set the GLIB_CONFIG variable using export to that location. I try again. Now it goes a step further, but I suspect that glib actually didn't install; odd that it would be in my src directory and not somewhere more general.

So now I turn to "PREFIX". What the heck is "PREFIX"? typing env does not turn up a variable named prefix. I presume it is some kind of path for something, but what? So how to find PREFIX/bin?

Lord, I despair of the entire GNU/foss installation nightmare. I can't think of one blinking install that actually went as advertised. :(

Can anyone tell me what obvious thing I'm missing here? I'd love to run mc on my Mac, I miss it terribly. I use it all the time on my linux systems.
And yeah, I tried the Java fu[] thing... it isn't mc, that's for sure. I'm in and out of my shell all the time. Need mc. Sniffle.


---
--fyngyrz



[ Reply to This | # ]