Xcode and Bandwidth Caps

For a long time, I’ve been in the habit of installing Xcode on Macs, even though I wasn’t developing software. (Partly because I wasn’t sure what I needed to run Fink/MacPorts/Homebrew, and partly because I think FileMerge is pretty sweet, even if it’s the last thing on this list of features.) But lately, the typical Xcode update is like 7 GB, and I just don’t need it. 

7.6 GB worth of awesomeness. :-/

So I wanted to know how to get rid of these monstrous downloads. And I found out. First, you get rid of Xcode. But that’s only step one:

$ cc
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use sudo xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools, or use xcode-select --install to install the standalone command line developer tools.
See man xcode-select for more details.

So, next, you have to get rid of the command line tools and reinstall them:

$ rm -rf /Library/Developer/CommandLineTools

$ xcode-select --install

UPDATE: When that doesn’t work, you read further down that page and find the correct answer:

$ sudo xcode-select -s /Library/Developer/CommandLineTools

Setting Up a Mac

Fixing mouse scroll direction, key bindings, setting up Exposé spaces, etc.

Installing Keynote, Numbers, and Pages plus any software previously purchased from the App Store.

Installing replacement browsers: Chrome, Firefox, and Brave, along with Xee and iTerm2 and Skim.

Installing MacPorts, then software starting with ImageMagick. Imagemagick because it’s a good test of everything working properly.

$ sudo port install imagemagick +graphviz -x11

Then adding some of my favorite utilities

$ sudo port install antiword bat colordiff exiftool jhead lame sox tree xz

$ sudo port install ffmpeg -x11

$ sudo port install nnn ranger

Then install software development languages: go, rust, and ruby. Follow them with some CLI utilities written in those languages:

$ cargo install broot cw du-dust dutree exa fd hexyl \
just lsd pastel ripgrep sd

$ go get -u github.com/gokcehan/lf

Another Old Computer

I picked up a new old computer. This one’s a Macbook Pro: the 17in model from early 2011. It’s pretty sweet.

The first screen I saw after logging in
About this Mac after upgrading to the last supported MacOSX.

It’s a behemoth. I can see how the modern Apple could never ship monsters like this. But it’s got a good, big screen and the HD is tolerably easy to upgrade.

And don’t overlook that super-useful ExpressCard/34 port, okay?

More of those CLI Utilities

I’ve found some more CLI utilities (via this thread) that look like they’re worth further investigation.

  • Zola, a static site generator
  • fd (a/k/a fd-find), an “80% replacement” for find; see also fselect
  • xsv, a tool for working with CSV files
  • broot, another disk analysis/tree replacement
  • sd, a sed replacement
  • cw, a wc replacement
  • hors, a combination of lynx and the technical web (which I couldn’t build on my Linux system because it’s running gcc instead of clang). (Ditto ‘bat’ btw.)
  • lolcate, a locate/updatedb replacement

I’m intrigued by topgrade but a little terrified of actually using it.

And I found the indispensable utility called genact.

Rust Command-Line Utilities

I’ve been learning (or maybe beginning to learn) the Rust programming language. (It was a toss-up between that and Go, and I probably picked wrong, but I won’t know until I know a lot more than I do now.)

  • Tokei (for counting source code lines) and
  • diffr as an alternative to colordiff
  • ripgrep as an alternative to ack (etc.)
  • just as a command runner (think “make”)
  • lsd and exa as replacements for ls
  • pastel for working with colors on the command line
  • skim (not to be confused with the excellent Skim) as a fuzzy finder
  • dust, dutree, and dua-cli as replacements for du
  • bat (“better cat”) and mdcat (cat for markdown)
  • starship (prompt)

I’m only beginning to play with these. But I was surprised to see so much activity developing command line utilities. There is some misunderstanding of the Unix philosophy, but it’s understandable (cat isn’t for viewing files, but of course that’s how most of us use it). Yay open source!

Duplicate Files

I’ve been hoarding data for more than 20 years. For backups, I used to burn a CD periodically, but I long since ran over those limits. Today, my backups are hard drives. One reason is that I’ve moved between computers several times during that period, and when I do, I find stuff I don’t know what to do with. So I copy all that data into a new folder, typically called something like temp/backup/that-system-name/tmp/old/save/keep/t.files/save.d.

After 20 years, that starts to add up. So I’ve been looking at programs to help me find and get rid of duplicates. (I’ve been using rsync -n, and occasionally diff -qr, to compare folders. But the problem is deciding what folders, at what places in the directory structure, to compare.)

So I’ve been looking to see what kind of tools are available to help. At this point, I looked at duff, jdupes, and dupd.

So far, I’ve focused on dupd. It does what I was thinking needed to be done: crawl the entire hierarchy and save the result as a database.

MacPorts revisited

I’m setting up my new (old) iMac and I thought I’d give MacPorts another try. I used it since the late 2000s. (I forget why I moved from Fink to MacPorts.) For the last five (?) years or so I’ve used Homebrew, but I’ve always been uneasy about making /usr/local writable, and never convinced by the blandishments on the Homebrew site. I heard about Nix, but before I tried something really different, I thought I’d give MacPorts another look.

So far, so good. I prefer to need sudo to install software. The only real problem I’ve encountered is that the MacPorts version of Pandoc is so old it can’t read docx files. (#sad!) But Pandoc has its own installer, so I’m trying that out too.

What I did after installing Linux

I had a hard drive fail on my laptop, so I put the best parts of several broken machines together into a sum-greater-than-the-whole new machine. Right now, I’m installing Ubuntu Linux 19.04. And, since it’s been a long time since I blogged what I do afterward, here is the mid-2019 edition.

References: the usual “what to do” blog posts, e.g., this, this, and this.

Start by installing updates:

$ sudo apt update && sudo apt dist-upgrade

Then gnome tweaks, to make your GUI act less lobotomized:

$ sudo apt install gnome-tweaks

The specific tweaks I want are left-side buttons, static workspaces, desktop icons for home but not trash, the size of the monospace font, and (since this is a 13″ laptop) the scaling factor. I also add a percentage to the battery indicator and weekday to the clock. While I’m monkeying around with my settings, I set up night mode. And then I make sure that Alt-Tab behaves correctly. (See here.)

Then I install the usual assortment of web browsers:

$ sudo apt install chromium-browser

(I also install Google Chrome from a .deb I download from their website.)

Then a whole bunch of things I need:

$ sudo apt install caffeine
$ sudo apt install vim

Then, before I forget, I install libreadline for other things to use:

$ sudo apt install libreadline-dev

Next, I finish installing the usual software subjects:

$ sudo apt install imagemagick colordiff jhead wv pandoc abiword antiword eyed3

Stuff from other systems

Then I’m ready to start pulling things from other machines. The easiest way to do that is to go over there and rsync them to me. So:

$ sudo apt install openssh-server
$ ssh-keygen  # hitting ENTER at each prompt
$ ssh-copy-id {whatever the other machines are}

Then I pop over to those machines and send the appropriate contents back here.

Ruby

Then I install ruby so I can use all the ruby tools I’ve developed over the years:

$ sudo apt install libssl-dev zlib1g-dev
$ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ cd ~/.rbenv/plugins/ruby-build
$ hash -r  # might not be necessary
$ rbenv install ( --list | some-version )
$ gem install coderay csv fileutils kramdown mini_magick optimist pericope pry tty-color tty-command tty-screen tty-table zxcvbn-ruby

More Software

Also Telegram, if this machine will be used for your private messaging.

And Dropbox.