Shell Person Help me keep the shell people alive.

26Apr/140

Install watir-webdriver Ruby Gem on OSX Mavericks

To install watir-webdriver on Mavericks I had to install XCode Command Line Tools first, using the following command:

xcode-select --install

However, even after installing Command Line Tools I was getting the following errors when installing the Ruby gem:

5Oct/1210

Easy Install Error “unable to execute clang” on Mountain Lion

Recently I've been getting the error

error: Setup script exited with error: command 'clang' failed with exit status 1

when trying to install various Python libraries using Easy Install on OSX Mountain Lion (with Server.app installed). This happened recently trying to install psycopg2, but I've seen it before when trying to install lxml.

server:Desktop shellperson$ sudo easy_install psycopg2
Password:
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/psycopg/
Reading http://initd.org/projects/psycopg2
Best match: psycopg2 2.4.5
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz
Processing psycopg2-2.4.5.tar.gz
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-TUzBu0/psycopg2-2.4.5/egg-dist-tmp-wjxjYJ
no previously-included directories found matching 'doc/src/_build'
unable to execute clang: No such file or directory
error: Setup script exited with error: command 'clang' failed with exit status 1

Fixed the problem by first installing Xcode from the App Store, then installing Command Line Tools from the Downloads section of Xcode's Preferences screen.

UPDATE: Now on Mavericks you can install Command Line Tools using the following command:

xcode-select --install

Credits:
http://stackoverflow.com/a/9403589

30Sep/120

New Location for org.postgresql.postgres.plist in Server.app 2.1.1

In Server.app 2.1.1 for OSX Mountain Lion, the PostgreSQL configuration file has been moved from

/System/Library/LaunchDaemons/org.postgresql.postgres.plist

to its new location at

/Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

You no longer need administrative privileges to edit it.

18Sep/120

Connect to OSX Server.app postgresql on Mountain Lion

Here are a few notes to remind myself how to connect to the default postgres instance used by OSX Server.app on Mountain Lion.

  1. Enable "Websites" in Server.app.
  2. Check if postgres is running
  3. sudo serveradmin fullstatus postgres
    
  4. If it's not, turn it on
  5. sudo serveradmin start postgres
    
  6. In order to connect with pgAdmin (and maybe through the terminal too), edit the file
    /System/Library/LaunchDaemons/org.postgresql.postgres.plist

    to replace

    <string>listen_addresses=</string>

    with

    <string>listen_addresses=127.0.0.1</string>
  7. UPDATE: The config file moved in the Server.app 2.1.1 update. It's now at:

    /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist
    
  8. Then restart postgres
  9. sudo serveradmin stop postgres
    sudo serveradmin start postgres
    
  10. Now, connecting with psql in terminal still causes this error (use template1 as the database name if you don't already have a database set up):
  11. server:~ shellperson$ psql template1
    psql: could not connect to server: Permission denied
    	Is the server running locally and accepting
    	connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
    
  12. My preference to work around this is to create a user named "root" in the database, so I can just login with sudo. In order to do this, first login as the default user (_postgres). Use your own password.
  13. server:~ shellperson$ sudo -u _postgres psql template1
    Password:
    psql (9.1.4)
    Type "help" for help.
    
    template1=# create role root login;
    CREATE ROLE
    template1=# \q
    

    Once the user is created, you can login with "sudo psql databaseName".

    server:~ shellperson$ sudo psql template1
    

Articles referenced:
http://www.mactasia.co.uk/revisited-using-postgresql-in-lion-server
http://www.mactasia.co.uk/video-how-to-configure-postgres-in-lion-server-10-7-4
http://www.naveoss.com/site/282/tutorials/appletutorials/accessing-osx-lion-server-postgresql

5Feb/112

Install Adobe Reader 9.4 in Debian Lenny

This is so easy it's hardly worth writing, but perhaps it will be of some value.  Here's how I installed Adobe Reader 9.4 in Debian Lenny (32 bit, x86).

  1. Download Adobe Reader 9.4 from http://get.adobe.com/reader/.  Alternatively, I think you could use this direct link with wget: http://ardownload.adobe.com/pub/adobe/reader/unix/9.x/9.4.0/enu/AdbeRdr9.4-1_i486linux_enu.bin
  2. Make the installation binary file executable:
    chmod +x AdbeRdr9.4-1_i486linux_enu.bin
  3. Start the installation (as su or sudo):
    sudo ./AdbeRdr9.4-1_i486linux_enu.bin
  4. Tell the installer where you want Reader installed.  It suggests /opt, which is a fine place to put it.
  5. You're done.  Open a PDF with:
    acroread filename.pdf

17Jan/11142

Oracle SQL Developer: Enter the full pathname for java.exe

I encountered the following message repeatedly when trying to start SQL Developer from my installation of Oracle Database 11g Enterprise: Enter the full pathname for java.exe.

No matter how many times I browsed to the correct path, I kept being presented with the exact same dialog box. This was in Windows 7, and the solution was to right-click on the SQL Developer icon and select "Run as administrator". I then used this path: C:\app\shellperson\product\11.1.0\db_1\jdk\jre\bin\java.exe

9Aug/100

Notes on Preventing Screen Blanking

Here are a few notes I've made on keeping the the screen from blanking in linux. I generally am using Ratpoison (and sometimes just the console), so these are notes on how to disable screen blanking in X and console situations, not the higher-level GNOME or KDE screensaver. I've come up with a configuration that works to keep my screen from ever turning off, but I don't have an in-depth understanding of exactly what's being done. Some of this may be redundant.

5Aug/102

Shortcut Script for Sprunge Pastebin

I discovered the scripting-friendly pastebin http://sprunge.us a few days ago via One Thing Well. It's extremely convenient to use, but in my laziness I've tried to make it even easier. Here is a script that will upload to sprunge and return the URL. It accepts piped data, STDIN redirection, filenames as arguments, and text strings as arguments. EDIT: while using the script, I just realized that using either form of STDIN input (pipe or redirection) will treat tabs as spaces. While this will occasionally break code, it will almost always make it less legible. So, if you need to preserve tab whitespace, I suggest using a filename as an argument to the script (e.g. sprunge myscript.txt). (Click "show source")

1Aug/100

Identifying a Program’s Package in Debian

If you need to discover from which package a particular program came from, you can use this command (note that that is a capital "S"):

dpkg -S /usr/bin/file_i_am_curious_about

Here's an example:

james@tv:~$ dpkg -S /usr/bin/sensible-browser 
debianutils: /usr/bin/sensible-browser

This was necessary because I apparently deleted /usr/bin/sensible-browser (which is a script that determines which web browser should be the default). To replace it, I needed to know the original package name, which turned out to be debianutils. From there it was a simple matter to do:

sudo apt-get install --reinstall debianutils

Tagged as: , No Comments
1Aug/100

Changing Debian’s sensible-editor

Debian uses the symlink /usr/bin/sensible-editor to point to the default text editor to use. This is controlled by the Debian Alternatives system, which will work automatically if you want it to. If, however, you want to change the auto-selected "sensible editor", you can do so with this command:

sudo update-alternatives --config editor

This will let you select one of your installed text editors from a list that will look something like this:

There are 5 alternatives which provide `editor'.

  Selection    Alternative
-----------------------------------------------
          1    /bin/ed
 +        2    /bin/nano
          3    /usr/bin/vim.tiny
          4    /usr/bin/mcedit-debian
*         5    /usr/bin/vim.basic

Press enter to keep the default[*], or type selection number: 

The "+" indicates the editor that would be selected if Debian had to choose, the "*" indicates your current choice.

Debian also maintains symlinks for sensible-browser and sensible-pager. You can change those easily as well:

sudo update-alternatives --config x-www-browser
sudo update-alternatives --config pager

If you find that your favorite program is not included in the list (most likely because it wasn't installed from a .deb package), you can add it like so:

sudo update-alternatives --install x-www-browser x-www-browser /usr/local/src/firefox/firefox 900

In English, this means install into the category x-www-browser, using the symlink named x-www-browser (found in /etc/alternatives), which points to the binary at /usr/local/src/firefox/firefox, and give it a numerical priority of 900. The priority determines which program Debian would select if set to auto. The largest number wins. This is how I added firefox into the list of potential sensible-browser selections.