Install libSVM on Mac OSX and use easy.py and grid.py - macos

I spent quite some time figuring out how to install libSVM on Mac OSX and use easy.py and grid.py. I've done quite some research but there are problems such as gnuplot isn't installed in the place where easy.py is calling it with brew.

It turned out I have to do the following steps
go to https://www.dropbox.com/s/rpn6yersv06tttz/gnuplot-4.2.5-i386.dmg
download the gnuplot-4.2.5-i386.dmg
open the resulting DMG file
open the gnuplot-4.2.3 DMG the Extras folder
drop Gnuplot.app into your applications folder
go to /usr/bin in terminal and do
$ sudo ln -sf "/Applications/Gnuplot.app/Contents/Resources/bin/
gnuplot"
You will be prompted to install X11 if you haven't done so, but after that if you run sample line like
python easy.py svmguide1 svmguide1.t
it should work. The sample files can be downloaded at http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html#svmguide1
references: http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf

Make sure Homebrew is installed, then just run:
brew install gnuplot
Link the executable, so that it is in the PATH (i.e. /usr/bin) and can be found by the Python scripts:
sudo ln -s /opt/local/bin/gnuplot /usr/bin/gnuplot
After that's done, libsvm's Python scripts should not complain any longer.

Since macOS high sierra, /usr/bin is not modifyable by the user anymore, gnuplot is installed at /usr/local/bin instead. Open easy.py and change the path from "/usr/bin" to "/usr/local/bin"

Related

Can't Install FFMPEG with homebrew

I tried installing FFmpeg with homebrew today. When I enter "brew install FFmpeg" I get this:
I tried running commands like brew doctor and git -C $(--repo homebrew/core)
I'm using macOS Big Sur btw.
EDIT: I installed FFmpeg as a final solution it seems to be working now. Thanks for helping, guys. I don't know what's wrong with my homebrew though.
It's a weird error, but a workaround would be to execute following commands:
$~ wget https://www.nasm.us/pub/nasm/stable/nasm-2.15.05.zip -O nasm.zip
$~ unzip nasm.zip
$~ cd nasm*
$~/nasm ./configure --prefix /usr
$~/nasm make
$~/nasm sudo make install
The above
downloads the zipped source code
unzips it
goes into the unzipped folder
configures the source code to have the programs installed to the right place
builds programs and libraries from the source code
installs everything that has been built
After that, your homebrew should find nasm and just skip it.
EDIT:
Whilst the above should work perfectly fine on Linux, I learned that it does not work on Mac OS (thank you #Philippe !) as stated in the Mac OS docs on System Integrity Protection:
System Integrity Protection includes protection for these parts of the system:
/System
/usr
/bin
/sbin
/var
Apps that are pre-installed with OS X
Paths and apps that third-party apps and installers can continue to write to include:
/Applications
/Library
/usr/local
So, we can conclude that we cannot install nasm into /usr, but into /usr/local. That means command No. 4 should be changed to ./configure --prefix /usr/local.
EDIT2:
In case you get an error in step 1, use curl https://www.nasm.us/pub/nasm/stable/nasm-2.15.05.zip -o nasm.zip instead.
In case you get an error about your shell not finding /bin/sh, prepend the name of a shell you have installed on your PC to the command line.

how to install libX11 on OSx 10.9?

I am trying to install ROOT (cern.root.ch). When I run ./configure , I get a message that libX11 is missing and must be installed.
I did some research and found that I need to install
) XQuartz (I already have the latest version.)
) Command line tools in Xcode.
I tried installing Command Line Tools from apple's developer website. The installation goes through smoothly but how do I know whether it has been installed? I still get libX11 missing error with root's configure command.
I also tried xcode-select --install and it once went through smoothly and then later again gives error saying this package is no longer maintained - or something of that sort.
I understand I may have multiple installations... But I am still facing the problem of not having libX11 and not being able to install ROOT.
Thanks,
Hershal.
This link and the one referenced in it suggests you use homebrew (brew) to install it
$ ruby <(curl -fsS https://raw.github.com/mxcl/homebrew/go)
$ brew doctor
Remember to add the Homebrew directory to your PATH by adding the directory (found with brew --prefix) to your .bashrc, .zshrc or whatever shell file you’re using (.bashrc is the OS X default). We’ll also add the XQuartz binaries to the PATH in case anything needs them in the future.
export PATH=/usr/local/bin:/opt/X11/bin:$PATH
Start a new Terminal session to pick up the changes.
Now that Homebrew is installed, we can use it to install the required dependencies. Each may take some time as Homebrew generally compiles from source.
$ brew install gfortran # Fortran compiler
$ brew install python # Python interpreter
$ brew install pcre # Regular Expressions library
$ brew install fftw # Fast Fourier Transforms
$ brew install cmake # Cross-platform make
install root
$ brew tap homebrew/science
$ brew install --with-cocoa root
You don't say whether you have installed XCode as well as the commandline tools but I think you will need it

Making symlink with pypy intalled via brew

I recently formatted my Mac OS X Mountain Lion and I installed pypy using brew -v install pypy as always. However, this time, when I hit pypy in the terminal, bash reported command not found.
I went check and brew did install pypy in the normal directory /usr/local/Cellar, but there is no link to pypy in /usr/local/bin as it used to have.
I made an alias with my mouse and moved it to /usr/local/bin. Then I typed:
chmod 755 pypy
And I tried to run pypy again typing:
pypy
so...
-bash: /usr/local/bin/pypy: cannot execute binary file
Does anybody have any idea of what is happening?
Try removing the alias you created with the mouse and create one with :
sudo ln -s /usr/local/Cellar/pypy /usr/local/bin/pypy

How do I uninstall subversion on OS X

I did svn --version on command line and it says it is 1.17.10.
I want to uninstall it completely, so I can re-install 1.16.12
How do I do that in OS X?
Thanks
As said Mike Christensen, in order to uninstall it, you just need to delete the binary. Run which svn to know where your binary is installed.
In order to install subversion, you need to:
Download it.
Uncompress it (tar xzf subversion-1.x.y.tar.gz).
Compile it (./configure && make).
Install it (sudo make install).
I’m pretty sure this will install it in /usr/local/bin. So if you want svn to call the subversion you just installed (instead of the one built in XCode), you need to edit your $PATH so that /usr/local/bin is before /usr/bin. On Mac OS X, editing the path is done by editing the file /etc/paths.
Note that steps 3 and 4 requires a compiler and make. The easiest way to get those on Mac OS X is to install XCode.
If you get any error in following Etienne Miret solution so the following
after setp 3
brew install apr
brew install apr-util
/configure --with-apr=/usr/local/Cellar/apr/1.5.2_3/ --with-apr-util=/usr/local/Cellar/apr-util/1.5.4_4 && make
sudo make install
After completion, you can see the new SVN installed here
/usr/local/bin/svn --version

How Do I Install Lua on MacOS?

I just downloaded Lua from the official website.
I want to install it on my Mac but I have no clue how. And I've never tried using Mac to install and use compilers other then (xcode , titanium , corona) so easy on me please :)
I tried this link but it does not work.
Also Is there a fully guided on how to install and start using Lua on mac? Because all I see is windows :S
note: Before I asked this question I searched on SOV but I could not find my answer.
This Wiki has few listing:
http://lua-users.org/wiki/MacOsxLua
If you use Homebrew (https://brew.sh/), just type:
brew update
brew install lua
Compiling from source code is not that painful.
Lua 5.1.4 here: http://www.lua.org/ftp/lua-5.1.4.tar.gz
Lua 5.2 alpha here: http://www.lua.org/work/lua-5.2.0-alpha.tar.gz
Take Lua 5.2 as example:
Open your Terminal.app
wget http://www.lua.org/work/lua-5.3.0-work3.tar.gz
tar xvzf lua-5.3.0-work3.tar.gz
cd lua-5.3.0-work3/src
make macosx(I believe you have Xcode installed)
After that, you can see 'lua' binary under current dir.
sudo cp lua /usr/bin/lua
Now you can enter lua to have a try. :)
If you have brew installed, just try:
brew install lua
You just follow this guide on http://www.lua.org/start.html:
Fire up your terminal and type in:
curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
cd lua-5.3.5
make macosx test
make install
You can even combine the last two steps to
make macosx install
After that I could just type in
lua
into my terminal and something like:
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
should appear. This means that lua is installed correctly.
With MacPorts:
sudo port install lua
If you have brew, use the following code:
brew update
brew install lua
That works for me.
Compile using source on mac
tar -zxvf lua-x.x.x.tar.gz
cd lua-x.x.x
make macosx
cd src
sudo cp lua /usr/bin/
Type lua and you should get the prompt.
I have just follow the Prajna's answer and go to http://www.lua.org/versions.html#5.3 to download the lua-5.3.6.tar.gz
And then use the terminal:
$cd lua-5.3.6/src
$make macosx
After that, you can see 'lua' binary under current dir.
After execute:
$sudo cp lua /usr/bin/lua
You can run the lua
You don't "install" it. It should just be a binary that runs from wherever you extract it to.
If you can't find a binary (there should be one linked somewhere on the Lua site) then just follow the instructions to build it from source.
Ah, here are the binaries: http://luabinaries.sourceforge.net/download.html
You'll probably want the file labelled "MacOS X Intel Executables"
The download url show below.
http://www.lua.org/download.html
lua-5.3.1.tar.gz
2015-06-10, 276K

Resources