There are several ways to install lpsolve on a Mac. Here is one way.
This will download the latest source code for lpsolve to your machine. It does not take long: lpsolve is a small program. The file will have a name like lp_solve_5.5.2.11_source.tar.gz. (The 5.5.2.11 is a version; you might get a new version.)
This will decompress the file and expand it into a set of folders. You should then see a folder named something like lp_solve_5.5 in your Downloads folder, together with the downloaded .gz file.
You may find it in the Utilities folder inside your applications folder.
cd cd Downloads cd lp_solve_5.5 cd lp_solve sh ccc.osx
xcode-select --installIt will take a few moments to this do installation. Then open a new terminal window, and try step #5 above again.
cd bin cd osx64 ls
This last command, ls, will list the files in this folder: you should see lp_solve listed. This is the executable application.
./lp_solve test.lplpsolve will run and give you the following result:
Value of objective function: 4.61764706 Actual values of the variables: x 3.58824 y 1.02941
This indicates that these values of x and y, the minimum sum x+y, 4.61764706, is achieved with x=3.58824 and y=1.02941 (approximately) while satisfying the specified constraints.
To create an alias, you will need to edit your bash profile. In your home directory, there may be a file like .bash_profile (if it is not there, you can create it). Note that this is a "hidden" file (since it starts with a dot), so you may not see it in Finder. You will need to make hidden files visible; depending on your OS version, there are various ways to do this. In Terminal, the command
ls -awill list all files in the current directory, including hidden ones. If you don't see .bash_profile, you can create one. Either edit .bash_profile and add this line:
alias lp_solve='/Applications/lpsolve/lp_solve'or create a new file, .bash_profile, containing that line.
Save the file, then restart Terminal and you will be able to execute lp_solve from any folder (which will be useful since you will likely create multiple folder for the different LPs we'll be looking at in the course.) The command to execture lp_solve will look like
lp_solve test.lpwhere test.lp is the text file containing the LP you want to solve. Note that the "./" is not needed if you make the alias (the ./ indicates to the operating system that you want to run the application lp_solve that is right there in the current directory. With the alias, the operating system is told where to find the application.)
echo 'alias lp_solve="/Applications/lpsolve/lp_solve"' >> .bash-profilewill add the alias to .bash_profile without using an editor (or create it if the file does not already exist). This also will not require you to make hidden files visible in Finder.