How to install pianobar on Ubuntu

In this quick tutorial I’ll show you how to install pianobar on ubuntu. Pianobar is a free/open-source, command line client for pandora. With pianobar you can:

- play and manage (create, add more music, delete, rename, …) your stations
- rate played songs and let pandora explain why they have been selected
- show upcoming songs/song history
- configure keybindings
- last.fm scrobbling support (external application)
- proxy support for listeners outside the USA

Here’s how to install it:

1. Install all dependencies:

sudo apt-get install git-core
sudo apt-get install libao-dev
sudo apt-get install libmad0-dev
sudo apt-get install libfaac-dev
sudo apt-get install libfaad-dev
sudo apt-get install libgnutls-dev
sudo apt-get install libjson0-dev

2. Download the latest copy from the git repository:

git clone git://github.com/PromyLOPh/pianobar.git

3. Go into the newly created folder (git automatically creates the folder calder pianobar) and install it.

make clean 
make 
sudo make install

****** Edit (September 4th 2013) ****

I wanted to add this here since I ran into trouble trying to install pianobar on OpenSuse 12.3. These are the packages and steps you’ll need to follow, and after these, just proceed with the same steps below.

Install these dependencies:


sudo zypper install libmad-devel libfaac-devel libfaad-devel libgnutils-devel libjson-devel gnutls libgnutls-devel python-gnutls automake cmake gmake gcc gcc-c++ libgcrypt libgcrypt-devel perl-threads

Edit the Makefile (the one you got when downloading pianobar via git, in step 2, and comment out the line below, replacing it as shown: (This would be around line #21 of the Makefile, comment out this entry –> CC=c99 and add this entry –> CC=gcc -std=c99 as shown below)


ifeq (${CC},cc)
        OS := $(shell uname)
        ifeq (${OS},Darwin)
                CC=gcc -std=c99
        else ifeq (${OS},FreeBSD)
                CC=cc -std=c99
        else
                #CC=c99 ### This line is commented out
                CC=gcc -std=c99 ## Add this line
        endif
endif


Now run these and you should be on your way:

gmake clean
gmake
sudo make install

Now you can proceed with the same steps shown below

****** End of Edit *******

4. After you have installed pianobar, you can create a config file where you’d have your username and password. (Beats having to type those everytime you start the app).

cd ~
mkdir .config/pianobar
vim .config/pianobar/config

5. add the following 2 lines and save the file

user = pandoraUserName
password = pandoraPassword

6. That’s it, just run pianobar from the command line and enjoy.

Hopefully this has helped you, and as always thank you for stopping by and please share with others, after all, code should be free.foscode.com | because code should be free

17 thoughts on “How to install pianobar on Ubuntu

  1. Dan, Once again thanks for all you have taught me! : ).
    I’ve got my new installation of Ubuntu 11.10 64 bit running on my newly installed hard drive.
    A 500 GB Toshiba. So having these tutorials as a reference is awesome.
    My pianobar is all set up and I was able to remember just enough of vim to make it work on the second try without looking at google!

  2. Best instructions ever. Worked perfectly on 10.04. (Except I needed a root for make install)

  3. @Matt Thanks for the heads up, I’ve reviewed the post to include sudo make install. Thanks again for stopping by.

  4. Thanks for this clear and concise how-to! As @Rick mentioned, installing the gnutls package is required, but besides that it worked like a charm. The extra bit about the config file was a nice bonus. :)

  5. By the way, if you get a /!\ Unsupported audio format! when trying to play a station, go ahead and add one of these to your config file mentioned in the main post: (only add 1 of them, NOT both)

    audio_format = mp3
    audio_format = aac

  6. i had an error with gnutls. if you have an issue during the make command, run “sudo apt-get install libgnutls-dev” then run make again

  7. @Rick, @Elizabeth, @lhasn Thanks for the input. I’ve updated the tutorial to also include the gnutls install.

  8. hi, dan, thank you for this! i was pulling my hair out on the INSTALL file until Google’ing here.

    1) as of today (5/15/2012), pianobar’s latest build (2012.05.06) seems to have an additional requirement: json (for C). so on ubuntu:

    sudo apt-get install libjson0-dev

    would be added.

    2) as you no doubt know, but perhaps some pianobar or git newbies wouldn’t:

    sometimes pandora updates its protocol, rendering our compiled pianobars obsolete (and the next time we try to run pianobar, we’ll get the message about “incompatible protocol” and to “update libpiano”). fortunately, the pianobar developers have historically been pretty good about getting updates to the protocol worked into the latest pianobar git repository. so, to update your pianobar , simply cd to your pianobar directory, then run the command:

    % git pull

    to update your pianobar files from the git repository (assuming the developers have made the changes) and re-run your (great) instructions above.

    3) just an curious question: any reason why step 1. isn’t just a one-liner, such as:

    % sudo apt-get install git-core libao-dev libmad0-dev libfaac-dev libfaad-dev libgnutls-dev libjson0-dev

    ?

    4) another ignorant question: i don’t know, do you? why simple ubuntu instructions aren’t included, perhaps with an INSTALL-Ubuntu.txt ? seems like it would save a lot of time.

    thanks again Dan! i’m back in the music! much appreciated.

  9. @Jeff Thanks for stopping by and great feedback, not too many visitors leave such constructive opinions. I really appreciate all the input and hope everyone else will as well. The answer to your questions :-)

    3- I just didn’t think of it, yes, the command can be in one line, I just messed up and never thought of making it a one liner, thanks for catching it :-)
    4- I agree with you, I wish they did, but I guess they would have to do the same for the other distros and it probaby would be too time consuming. With that being said, pianobar folks do an awesome job in updating the app whenever possible and maybe they get to the howtos someday :-)

    Thank you again for the great input you’ve provided and please feel free to share more at any time :-)

  10. @Jesse Thanks for giving the guys the input, that’s what makes open software great. Glad you got it working under 12.04

  11. Thanks for the great instructions. I just did a new install of pianobar on 12.04, and I heard something I’ve never heard before:

    When I run pianobar in a graphical terminal window, I occasionally hear a commercial play, although I’ve never had ads play using pianobar on my Mac.

    Has anybody experienced this?

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>