iMac configuration

I mentioned previously how I’ve rehabilitated the 10-year old iMac. Today, I’ve been setting up the software environment.

First, I transferred my iTunes library over to the new computer.

Then I installed some non-Safari browsers: Chrome, Firefox, and Brave.

Then I set up Homebrew, and after that, ruby:

$ brew install openssl # various messages because Apple doesn’t like openssl
$ brew install sqlite pcre
$ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install -l
$ rbenv install 2.4.1 # (as of May 19, 2017)
$ hash -r # rehash your environment

Things I Did After Installing 17.04

Here in one place is my list of things to do after installing a new operating system.

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install ssh

Then try to ssh into the computer. If needed, apply the fix to Zeroconf / Avahi / NSSwitch.conf.

Next:

$ sudo apt install git
$ sudo apt install colordiff
$ sudo apt install libreadline-dev
$ sudo apt install vim vim-gtk3
$ sudo sudo apt-get --purge --reinstall install ttf-mscorefonts-installer

Then I got things ready for ruby. I prefer rbenv:

$ sudo apt install libssl-dev zlib1g-dev # needed for ruby
$ sudo apt install sqlite3 sqlite3-pcre
$ cd ; git clone git://github.com/sstephenson/rbenv.git .rbenv
$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install -l
$ rbenv install 2.4.1 # (as of April 28, 2017)
$ hash -r # rehash your environment

P.S. if later on you want a later version of ruby, the way you update the list of installable ruby’s is:

$ cd ~/.rbenv/plugins/ruby-build ; git pull

Then use gdebi to install Google Chrome.

$ sudo apt install gdebi
$ apt install chromium-browser chromium-codecs-ffmpeg chromium-codecs-ffmpeg-extra
$ apt install telegram-desktop

I’d love to be able to pre-populate Dropbox from a local backup when I setup a new computer. But I’m not smart enough, I guess.

$ sudo apt install antiword wv jhead
$ sudo apt install imagemagick poppler-utils

Tech Links

LinuxUser (UK): Create a NAS box from spare parts.

Ars: Intel’s Broadwell mini-PC. I love the form factor. But then, I’ve owned three Mac Minis.

I keep thinking I should learn the R language. Of course, I used to think that about GnuPlot.

HowToForge: Installing Git and Using GitHub on Ubuntu.

GSoC: SciRuby. There’s a program I’d love to rewrite 20 years later using a high-level language to do the Fast Fourier Transforms. I’m not sure what I’d use for the GUI.

Web UpD8: Install the official Telegram client for Linux.

 

 

 

 

rbenv notes

I used to use rvm to manage my ruby environment, but the latest hotness seems to be rbenv. Here are some tips about using it. They’re aimed at me, because by the next time I need to use it, I’ll have forgotten. But you can read them too:

One of the things you want is rbenv-build:

Installing ruby-build as an rbenv plugin will give you access to the rbenv install command.

$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone git://github.com/sstephenson/ruby-build.git

(Note the assumption you’re using git. I don’t know what people who prefer mercurial are supposed to do.)

This will install the latest development version of ruby-build into the ~/.rbenv/plugins/ruby-build directory. From that directory, you can check out a specific release tag. To update ruby-build, run git pull to download the latest changes.

But that won’t work with Mountain Lion. So you’ll need a version of ruby that can be built with clang.

$ rbenv install 1.9.3-p125

Ruby and Mac OS X Lion

When Apple switched from GCC to LLVM in Xcode 4.2, they made it significantly more difficult for me to run ruby 1.9.2. (What are the odds this will get easier with Mountain Lion?)

I was using rbenv and its rbenv-build plugin to install ruby 1.9.2 and it told me this:

$ rbenv install 1.9.2-p320

ERROR: This package must be compiled with GCC, but ruby-build couldn't
find a suitable `gcc` executable on your system. Please install GCC
and try again.

DETAILS: Apple no longer includes the official GCC compiler with Xcode
as of version 4.2. Instead, the `gcc` executable is a symlink to
`llvm-gcc`, a modified version of GCC which outputs LLVM bytecode.

For most programs the `llvm-gcc` compiler works fine. However,
versions of Ruby older than 1.9.3-p125 are incompatible with
`llvm-gcc`. To build older versions of Ruby you must have the official
GCC compiler installed on your system.

TO FIX THE PROBLEM: Install the official GCC compiler using these
packages: https://github.com/kennethreitz/osx-gcc-installer/downloads

You will need to install the official GCC compiler to build older
versions of Ruby even if you have installed Apple's Command Line Tools
for Xcode package. The Command Line Tools for Xcode package only
includes `llvm-gcc`.

Note: when you install that, it doesn’t (appear to) provide an uninstaller. Instead it says this:

If something doesn’t work as expected, feel free to install Xcode over this installation.

Once installed, you can remove Xcode completely with the following:

sudo /Developer/Library/uninstall-devtools –mode=all

Bummer for me, huh? Mercifully, the GCC installation package doesn’t mess up the llvm-gcc link in /usr/bin/gcc. But that means when I do the ruby build, I need to add:

export CC=/usr/bin/gcc-4.2

Nice Piece on Using Vim

I ran across this nice reflection on the vim editor by someone who switched 18 months ago. In my own case, it was about 18 years. I’d been an emacs user forever, and it was just killing me (carpal tunnel, tennis elbow, and who-knows-what). So I made the switch to vi (and, soon enough, vim). It took awhile to get used to modes, but the alternative is playing Twister with my ring and pinky fingers.

irb with readline

I might have posted too soon yesterday. My irb incorporates readline now, but it appears to honor only emacs keybindings. Bummer, huh? I used to be an emacs user, so I can get by for now, but I’d really like to figure out how to get vi keybindings.

Google Refine

A while ago, Google bought the company that made Freebase, a tool for making sense of messy data. Earlier this week, they released a 2.0 version of that software, now renamed Google Refine. Watch the videos to see what that does.

This looks pretty darned impressive. For great chunks of my career, I’ve been doing work like that the hard way. In the 1980s, I started my career by doing data reduction in Fortran, but quickly graduated to sed and awk, and in the 2000s I used perl and ruby. Of course, when I say “the hard way,” that is in hindsight. Each of those was an improvement over what I used before, and this looks like it could be a similar type of improvement.

(I still do some of that kind of work even now. It’s been a couple of years, but I probably spent at least a week, spread across too many evenings and weekends, massaging the church directory from a text format Word document into tabular spreadsheet data.)