Skip to content

Instantly share code, notes, and snippets.

@jheasly
Forked from 0xabad1dea/rtlsdr-osx.txt
Last active February 26, 2021 04:02
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jheasly/9477732 to your computer and use it in GitHub Desktop.
Save jheasly/9477732 to your computer and use it in GitHub Desktop.
Build RTL-SDR on OSX with no tears using homebrew. Forked from https://gist.github.com/0xabad1dea/5777726, a macports solution.
rtl-sdr build notes for OSX
using macports http://www.macports.org/
see http://sdr.osmocom.org/trac/wiki/rtl-sdr
brew install cmake
brew install libusb
brew install pkgconfig
brew install sox # for easy audio
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build/
cmake ../
make
sudo make install
rtl_test -t
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.
@fyngyrz
Copy link

fyngyrz commented Dec 1, 2015

When you say "builds on OS X", you are being unclear (and incorrect.) This does not brew/build on OS X 10.6.8

When you provide a step by step, it is important to specify the environment(s) in which you have performed these steps successfully. IE, OS X 10.10.1, etc.

Appreciate the effort. Sadly, it ate half an hour of my time and nothing to show for it but partially installed precursors.

@rbdixon
Copy link

rbdixon commented Dec 2, 2015

Worked fine for me on El Capitan.

@awootton
Copy link

Thanks.
I did this on both yosemite and el capitan today and it worked.

@angelkjos
Copy link

Thanks, worked great on 10.11.1 ElCapitan and connected successfully with cheap Chinese RTL-Dongle.

@kgorman
Copy link

kgorman commented Feb 11, 2016

Thx for this!

@buley
Copy link

buley commented Mar 25, 2016

Works great on the latest, today El Cap 10.11.4

~~

Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.

@obezuk
Copy link

obezuk commented Jan 29, 2017

Worked great!

@imryan
Copy link

imryan commented Jul 30, 2017

Worked for me on Sierra 10.12. Cheers!

@ruudk
Copy link

ruudk commented Sep 12, 2017

Works on Sierra 10.12.6 Thanks!!

@rgrosset
Copy link

rgrosset commented Mar 27, 2018

High Sierra 10.13.3 not working and getting a compile error

~/git/sdr/rtl-sdr/src/rtl_test.c:165:4: error: member reference type
      'struct timespec' is not a pointer; did you mean to use '.'?
        ts->tv_sec = tv.tv_sec;

~/git/sdr/rtl-sdr/src/rtl_test.c:165:13: error: expression is not
      assignable
        ts->tv_sec = tv.tv_sec;

Following the error message suggestions I changed
ts->tv_sec = tv.tv_sec;
to
ts.tv_sec = tv.tv_sec;

and everything compiled and rtl_test -t worked fine. Thanks!

@lemonkey
Copy link

lemonkey commented Apr 4, 2018

Yep, had to manually edit rtl_test.c as well on high sierra.

@sdp8483
Copy link

sdp8483 commented Jul 20, 2018

Shouldn't line two say using homebrew not macports?

@TheButterZone
Copy link

$ brew install libusb
==> Downloading https://homebrew.bintray.com/bottles/libusb-1.0.22.high_sierra.b
######################################################################## 100.0%
==> Pouring libusb-1.0.22.high_sierra.bottle.tar.gz
Error: The brew link step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink lib/libusb-1.0.0.dylib
Target /usr/local/lib/libusb-1.0.0.dylib
already exists. You may want to remove it:
rm '/usr/local/lib/libusb-1.0.0.dylib'

To force the link and overwrite all conflicting files:
brew link --overwrite libusb

To list all files that would be deleted:
brew link --overwrite --dry-run libusb

Possible conflicting files are:
/usr/local/lib/libusb-1.0.0.dylib
/usr/local/lib/libusb-1.0.dylib -> /usr/local/lib/libusb-1.0.0.dylib
==> Summary
[mug icon] /usr/local/Cellar/libusb/1.0.22: 29 files, 514.9KB

@richardh9935
Copy link

Thanks.
Worked (or at least as far as I can tell...) on Mojave 10.14.5 today. (2019-06-12)

@ajmas
Copy link

ajmas commented Mar 10, 2020

I have made a version of these instructions based on MacPorts:

https://gist.github.com/ajmas/144719991f54931b99de43efae13389f

Feel free to copy anything useful.

@euquiq
Copy link

euquiq commented Oct 5, 2020

Hi! Under macOS Catalina (10.15.7) I am following these instructions. Among the previous commands,

I issued the brew install libusb and it finished with no errors. But, later when inside rtl-sdr/build when running make, I get:

user@MBP % make
Scanning dependencies of target convenience_static
[  3%] Building C object src/CMakeFiles/convenience_static.dir/convenience/convenience.c.o
[  6%] Linking C static library libconvenience_static.a
[  6%] Built target convenience_static
Scanning dependencies of target rtlsdr
[  9%] Building C object src/CMakeFiles/rtlsdr.dir/librtlsdr.c.o
[ 12%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_e4k.c.o
[ 15%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_fc0012.c.o
[ 18%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_fc0013.c.o
[ 21%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_fc2580.c.o
[ 25%] Building C object src/CMakeFiles/rtlsdr.dir/tuner_r82xx.c.o
[ 28%] Linking C shared library librtlsdr.dylib
[ 28%] Built target rtlsdr
Scanning dependencies of target rtl_test
[ 31%] Building C object src/CMakeFiles/rtl_test.dir/rtl_test.c.o
[ 34%] Linking C executable rtl_test
ld: library not found for -lusb-1.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/rtl_test] Error 1
make[1]: *** [src/CMakeFiles/rtl_test.dir/all] Error 2
make: *** [all] Error 2

Any ideas or help are appreciated.

@itchesavvy
Copy link

Try this make LIBRARY_PATH=/usr/local/lib

@richardh9935
Copy link

richardh9935 commented Feb 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment