Skip to content

Instantly share code, notes, and snippets.

@coolaj86
Last active April 27, 2022 16:34
Show Gist options
  • Save coolaj86/1eb4293c520022c5f4f85f4867c6f3bd to your computer and use it in GitHub Desktop.
Save coolaj86/1eb4293c520022c5f4f85f4867c6f3bd to your computer and use it in GitHub Desktop.
Installing libdvdcss on macOS Sierra

libdvdcss.pkg will no longer install on OS X (now macOS).

Here's how to build and install libdvdcss.2.dylib so that you can use it with, for example, VLC and/or Handbrake.

The old way

wget https://download.videolan.org/libdvdcss/1.2.11/macosx/libdvdcss.2.dylib

sudo rsync -av libdvdcss.2.dylib /usr/lib/libdvdcss.2.dylib

Install via Brew

Install X Code Tools

sudo xcode-select --install
sudo xcodebuild -license accept

Install brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install libdvdcss

brew install libdvdcss

Compiling from Source (solved)

Install autotools

brew install autoconf
brew install automake

Clone libdvdcss

git clone http://code.videolan.org/videolan/libdvdcss.git

Build libdvdcss

Use the default bash. If you're running custom shell such as fish or zsh, switch back to bash for this.

pushd libdvdcss

git checkout 1.4.0

autoreconf -i

./configure --prefix=/usr

make

sudo make install

Errors you may encounter

If you have a ( in the path to your compile folder you'll get this error:

cd . && git log > /Volumes/Data/Dropbox (Personal)/git/libdvdcss/ChangeLog-tmp
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `cd . && git log > /Volumes/Data/Dropbox (Personal)/git/libdvdcss/ChangeLog-tmp'
make[1]: [ChangeLog] Error 2 (ignored)
test -s ChangeLog-tmp && mv ChangeLog-tmp ChangeLog
make[1]: *** [ChangeLog] Error 1
make: *** [all] Error 2

Warnings you can ignore

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
  CC       src/libdvdcss.lo
  CC       src/device.lo
  CC       src/css.lo
  CC       src/ioctl.lo
src/ioctl.c:162:5: warning: missing field 'reserved0008' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDCopyrightInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:162:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDCopyrightInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:162:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:298:5: warning: missing field 'reserved0008' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDDiscKeyInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:298:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_read_structure_t, DVDDiscKeyInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:298:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:428:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDTitleKeyInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:428:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDTitleKeyInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:428:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:545:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationGrantIDInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:545:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationGrantIDInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:545:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:640:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDChallengeKeyInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:640:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDChallengeKeyInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:640:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:748:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationSuccessFlagInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:748:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDAuthenticationSuccessFlagInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:748:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:858:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDKey1Info,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:858:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDKey1Info,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:858:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:953:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_send_key_t, DVDAuthenticationGrantIDInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:953:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_send_key_t, DVDAuthenticationGrantIDInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:953:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:1046:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_send_key_t, DVDChallengeKeyInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:1046:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_send_key_t, DVDChallengeKeyInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:1046:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:1155:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_send_key_t, DVDKey2Info,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:1155:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_send_key_t, DVDKey2Info,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:1155:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
src/ioctl.c:1272:5: warning: missing field 'keyClass' initializer [-Wmissing-field-initializers]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDRegionPlaybackControlInfo,
    ^
./src/ioctl.h:63:26: note: expanded from macro 'INIT_DVDIOCTL'
    DKDVD_TYPE dvd = { 0 }; \
                         ^
src/ioctl.c:1272:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    INIT_DVDIOCTL( dk_dvd_report_key_t, DVDRegionPlaybackControlInfo,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/ioctl.h:64:27: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                          ^
src/ioctl.c:1272:5: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
./src/ioctl.h:64:29: note: expanded from macro 'INIT_DVDIOCTL'
    BUFFER_TYPE dvdbs = { 0 }; \
                            ^
33 warnings generated.
  CC       src/error.lo
  CCLD     libdvdcss.la
cd . && git log > /tmp/libdvdcss/ChangeLog-tmp
test -s ChangeLog-tmp && mv ChangeLog-tmp ChangeLog
rm -f ChangeLog-tmp
test -e ChangeLog || touch ChangeLog

What the installer output looks like:

 ./install-sh -c -d '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   libdvdcss.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libdvdcss.2.dylib /usr/local/lib/libdvdcss.2.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libdvdcss.2.dylib libdvdcss.dylib || { rm -f libdvdcss.dylib && ln -s libdvdcss.2.dylib libdvdcss.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libdvdcss.lai /usr/local/lib/libdvdcss.la
libtool: install: /usr/bin/install -c .libs/libdvdcss.a /usr/local/lib/libdvdcss.a
libtool: install: chmod 644 /usr/local/lib/libdvdcss.a
libtool: install: ranlib /usr/local/lib/libdvdcss.a
 ./install-sh -c -d '/usr/local/share/doc/libdvdcss'
 /usr/bin/install -c -m 644 AUTHORS COPYING NEWS README ChangeLog '/usr/local/share/doc/libdvdcss'
 ./install-sh -c -d '/usr/local/lib/pkgconfig'
 /usr/bin/install -c -m 644 src/libdvdcss.pc '/usr/local/lib/pkgconfig'
 ./install-sh -c -d '/usr/local/include/dvdcss'
 /usr/bin/install -c -m 644 src/dvdcss/dvdcss.h src/dvdcss/version.h '/usr/local/include/dvdcss'
@Elapharb
Copy link

On High Sierra, you may also need to tell it to install into /usr/local as it can't live elsewhere now. I had to do this right before the make after it failed the first time with the follwing error:
install: /usr/lib/libdvdcss.2.dylib: Operation not permitted
make[1]: *** [install-libLTLIBRARIES] Error 71
make: *** [install-am] Error 2
To switch that directory I used:
./configure --disable-dependency-tracking --with-readline=brew --prefix readline --prefix='/usr/local'

@TailoredITRob
Copy link

On High Sierra:

git clone http://code.videolan.org/videolan/libdvdcss.git
autoreconf -i
./configure --prefix=/usr/local
sudo make
sudo make install

@phlbnks
Copy link

phlbnks commented Apr 9, 2018

On High Sierra this worked:
curl -O https://download.videolan.org/libdvdcss/1.2.11/macosx/libdvdcss.2.dylib
sudo mkdir -p /usr/local/lib
sudo mv libdvdcss.2.dylib /usr/local/lib/

Which in pseudo code is:
download libdvdcss to current directory using the source name (libdvdcss.2.dylib)
make the directory /usr/local/lib if it doesn't already exist
move libdvdcss.2.dylib to /usr/local/lib

@brookinc
Copy link

brookinc commented Jun 3, 2018

@emirpprime's steps worked for me on High Sierra. 👍 👍

@beradster
Copy link

@brookinc - How did you do this? I updated Sierra last night and now my Handbrake does not work - crashing. I thought I installed that libdvdcss file last year. I also tried that @emirpprime with no success. Do we need the actual file saved somewhere specific? I downloaded from Handbrake's site

@tristan-k
Copy link

tristan-k commented Jul 8, 2018

For me it was (last two steps are optional for a working fairmount):

$ brew install libdvdcss
==> Downloading https://homebrew.bintray.com/bottles/libdvdcss-1.4.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libdvdcss-1.4.2.high_sierra.bottle.tar.gz
 /usr/local/Cellar/libdvdcss/1.4.2: 18 files, 362.7KB
$ locate libdvdcss | grep dylib
/usr/local/Cellar/libdvdcss/1.4.2/lib/libdvdcss.2.dylib
/usr/local/Cellar/libdvdcss/1.4.2/lib/libdvdcss.dylib
/usr/local/lib/libdvdcss.2.dylib
/usr/local/lib/libdvdcss.dylib
$ mkdir ~/Library/Application\ Support/Fairmount
$ ln -s /usr/local/Cellar/libdvdcss/1.4.2/lib/libdvdcss.2.dylib ~/Library/Application\ Support/Fairmount/libdvdcss.2.dylib

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