Installing Lua 5.2.0 on OS X 10.7.3 with X Code 4.3.2

Posted on 2012-04-02
Last Modified: 2012-06-12
So, my class is working with Lua, and we cannot figure out how to get it on our Macs.  We are up to date on everything, and from what I can tell, that is the problem.  Apple has been bundling X Code into an app, and that has allegedly been causing problems accessing /usr/bin commands in the Terminal, which we need in order to do development in certain situations.  

One came up recently, when trying to get Lua on our Macs.  According to the Lua page and countless guides, I have to unzip the folder, get to the directory with the makefile, and run
make macosx

Open in new window

I get
-bash:make:command not found

Open in new window

I have tried to work around this by creating symbolic links of the entire contents of the Developer/usr/bin folder to the local /usr/bin, and I was able to run the make command.  However, it ended in disaster:
Cliffs-MacBook-Air:lua-5.2.0 Cliff$ make macosx
cd src && make macosx
make all SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_MACOSX    -c -o lapi.o lapi.c
lapi.c:9:20: error: string.h: No such file or directory
In file included from luaconf.h:11,
                 from lua.h:16,
                 from lapi.c:14:
/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:15:25: error: limits.h: No such file or directory
make[2]: *** [lapi.o] Error 1
make[1]: *** [macosx] Error 2
make: *** [macosx] Error 2

Open in new window

Question by:prototrumpet
  • 2
  • 2
LVL 39

Expert Comment

by:Eoin OSullivan
ID: 37796807
I assume this is the LUA you are interested in using (

I find that installing Unix apps on OSX that involve compiling etc. can be a real headache .. it is easier to use pre-built packages using something like MACPORTS as these are tried and tested on OSX Snow Leopard and OSX Lion

The last post on this page shows the steps required... you have XCode installed .. so you simply install macports then the specific lua packages you require

Author Comment

ID: 37797185
I thought of MacPorts but haven't tried it yet because the latest version I saw was a 5.1.X and the current was 5.2.0.  If that's my only option though, I'll have to go for it.  I will reply with results shortly, thanks!

Author Comment

ID: 37797350
Here is what I am getting when trying to install with MacPorts:

Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details)
Error: Failed to install ncurses
Log for ncurses is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ncurses/ncurses/main.log
Error: The following dependencies were not installed: readline ncurses
Error: Status 1 encountered during processing.
To report a bug, see <>

Open in new window

I believe the shell command failed error is due to a lot of the developer shell commands you get with X Code not working, which is essentially the basis of my problem, I believe.  I can't access make, gcc, g++, etc without the X Code GUI.  My system, since installing the latest version of X Code via the App Store, has been neutered of all of its Terminal development prowess.  Any ideas?
LVL 39

Accepted Solution

Eoin OSullivan earned 500 total points
ID: 37797519
Maybe you should delete and do a re-install the latest XCode using the AppStore as it sounds like the XCode installation might be at issue.

I've had no problem installing macports or any of its packages..

I'd recommend you get rid of those symbolic links in the Developer/usr/bin/ folder ..

Did you have earlier versions of XCode installed which may be confusing things?

I simply installed macports .. after ensuring that the 3 steps below were complete

1. Install Xcode 4.3 from Mac App Store
2. Install Command Line Tools for Xcode
3. Run the command in a Terminal window ... sudo /usr/bin/xcode-select -switch /Applications/

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question