[Android General] ojosilva:
So, I was able to compile and flash my Galaxy J5 from my Mac OSX Yosemite command line, and I'd like to share the experience. I'm a beginner at flashing and the Android world, so I struggled to understand I did not need Odin for taking control over my Galaxy J5.

The following should work for most versions of OSX / MacOS, as long as you have a compiler installed. But I've only tested it in my Yosemite machine.

All binary packages for Heimdall did not work for me. I was getting a persistent "libusb error -7 whilst sending packet". So I decided to build everything from source and forget about Odin, JOdin3 and the like.

I already had a development environment setup in my Mac, with the stock Xcode cc compiler. So I can only relate the additional dependencies I had to install (+ GIT). But it could be that I had additional software that is required from my brew installed packages. At the end of the post I list all my brew installed packages just in case.

1) Make sure you have a compiler (Xcode dev tools) installed. This is standard Apple stuff. Just google "install xcode mac" for your Mac version.

2) Install Homebrew (url is brew.sh), and the following packages:

brew install git
brew install cmake

3) Build libusb from source

cd /tmp
git clone https://github.com/libusb/libusb
cd libusb
./autogen.sh
make
cd /tmp

4) Build Heimdall

cd /tmp
git clone https://github.com/Benjamin-Dobell/Heimdall
cd Heimdall/
cmake -DLIBUSB_LIBRARY=/tmp/libusb/libusb -DLIBUSB_INCLUDE_DIR=/tmp/libusb/libusb -DDISABLE_FRONTEND=1 .
make

5) If you had no errors in the previous make steps, run Heimdall. You ca print your PIT, flash, etc, from the command line and never use Odin AFAIK. Take your phone into "Download Mode" (Vol Down + Home + Power button from a powered down state). Then try the print-pit Heimdall command (which takes a few minutes to complete).

cd /tmp/Heimdall/bin
sudo ./heimdall print-pit --no-reboot
sudo ./heimdall flash --17 recovery.img

etc....

BTW, move both Heimdall and libusb directories out of /tmp/ if you intend to preserve them after your Mac reboots. Create something like /Users/[your_user]/build/ to keep it safe and replave all "/tmp/" dirs in the lines above with your destination directory.

Have fun!

=====================

The following is a list of all my brew-installed packages, just in case you're missing a dependency and not sure which package I had that could make this work in my machine.

~/dev/build/Heimdall$ brew list
android-sdk	gifsicle	id3lib	meld	redis
atk	git	imagemagick	net-snmp	ruby
autoconf	glew	jbig2dec	netcat	scala
automake	glib	jpeg	nettle	sdl2
boost	glm	lame	nexus	sdl2_image
brew-cask	gmp	libepoxy	nmap	sqlite
cairo	gnome-icon-theme	libev	node	texi2html
cmake	gnu-sed	libffi	openssl	tig
cscope	gnupg	libogg	p7zip	tree
d-bus	gnutls	libpng	pango	unrar
ffmpeg	go	libtasn1	pcre	v8
fontconfig	gobject-introspection	libtiff	phantomjs	watch
freetype	gource	libtool	pixman	webp
gawk	gsettings-desktop-schemas	libvo-aacenc	pkg-config	wget
gd	gtk+3	libvorbis	py2cairo	x264
gdbm	gtksourceview3	libvpx	pygobject3	xvid
gdk-pixbuf	harfbuzz	libyaml	python	xz
geoip	hicolor-icon-theme	little-cms2	qemu	yasm
gettext	httrack	macvim	qt5
ghostscript	icu4c	maven	readline