Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

Fix Installation of Ruby using rbenv on macOS Big Sur

April 26, 2021 by Rob Bazinet Leave a Comment

Tweet

I’ve been using with rbenv to manage installation and switching of Ruby versions for the pass year and have been very happy with it. I recently took the plunge and upgraded my main Apple MacBook Pro from macOS Catalina to Big Sur. Everything seemed to work well after the upgrade. Until I tried to install a new version of Ruby.

Problem

When performing the usual command to install Ruby with rbenv, I started getting this message:

~ $ rbenv install 2.6.7
Downloading ruby-2.6.7.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.7.tar.bz2
Installing ruby-2.6.7...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.2.3 using ruby-build 20210423)
Inspect or clean up the working tree at /var/folders/mq/tlm78wy92v54ygbzfykqc8640000gn/T/ruby-build.20210424214159.42314.u6mGui
Results logged to /var/folders/mq/tlm78wy92v54ygbzfykqc8640000gn/T/ruby-build.20210424214159.42314.log
Last 10 log lines:
        rb_native_mutex_destroy(&vm->waitpid_lock);
        ^
vm.c:2489:34: warning: expression does not compute the number of elements in this array; element type is 'const int', not 'VALUE' (aka 'unsigned long') [-Wsizeof-array-div]
                             sizeof(ec->machine.regs) / sizeof(VALUE));
                                    ~~~~~~~~~~~~~~~~  ^
vm.c:2489:34: note: place parentheses around the 'sizeof(VALUE)' expression to silence this warning
compiling dmyenc.c
1 warning and 1 error generated.
make: *** [vm.o] Error 1
make: *** Waiting for unfinished jobs....
~ $

Trying to figure out the problem by looking at the message, it didn’t seem like something I could fix. Searching the rbenv Github issues didn’t give many clues. Knowing that rbenv uses ruby-build to automate the Ruby build process, I looked at the issues reported. It looks like I was not the only one having similar problems.

CleanShot 2021 04 24 at 21 51

I tried several of the suggestions found from those issues and none of the solutions worked.

Solution

I decided to turn to my friends on Twitter to see if anyone had faced this issue. Twitter never lets me down and Robby Russell of Planet Argon came through,  suggesting installing Ruby with these CFLAGS:

CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.6.7

It worked perfectly and I was able to get additional versions of Ruby installed. This should also work if you’re having problems with asdf Ruby version manager too. Asdf uses ruby-build behind the scenes.

I wondered why I hadn’t stumbled on this solution in the ruby-build issues on Github. It turned out I saw the issue but ignored it because it referenced installing older versions of Ruby when Xcode 12 was installed. I have Xcode 12 but was installing new versions of Ruby. The ticket was a little deceiving as it worked with new versions as well.

For those interested in the details, they can be found in the ticket – Installing older Ruby versions on OSX after Xcode 12.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac, Ruby Tagged With: rbnev, Ruby

Status Bar in iTerm2

April 7, 2020 by Rob Bazinet Leave a Comment

Tweet

I’m a big fan of iTerm2. I’ve used it since it’s inception and haven’t looked back. Even after all of this time I still discover features I didn’t know existed, mainly because I wasn’t looking for them.

I recently discovered you can have a status bar at the top of the terminal window with various stats and data points. My status bar is simple at the moment; containing system CPU usage, memory usage and disk throughput.

2020 04 07 09 38 21

How did you do that?

Adding the status bar is pretty simple. Go to iTerm2 -> Profiles -> Session:

2020 04 07 09 33 49

Check the box for Status bar enabled and then configure the status bar by clicking the Configure Status Bar button.

There are a bunch of options here so I think it’s worth playing around with how the terminal looks. There is even an option to run a script, which opens up many possibilities. Simply drag-and-drop the component you want to have in your status bar. Select a component you made active and you can customize it by the Configure Component button.

2020 04 07 09 33 21

If anyone sets this up and adds calls to scripts, I’d love to hear how you use this feature or how you get creative with other features.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac Tagged With: iterm2

Supporting Multiple SSH Keys on macOS

April 3, 2020 by Rob Bazinet Leave a Comment

Tweet

If you’re a developer, on devops or a system admin you probably use an SSH key to log into remote servers.

I am typically on multiple projects at one time and some organizations require I generate a unique SSH key in order to work with them. I’ve been fortunate until recently that my personal SSH key was acceptable.

So, how can you have two or more SSH keys available on your system at any one time? I am running a Mac but I assume this would work on Linux as well.

It’s not hard and when setup, it works really well.

Getting Started

The first part is generate a new SSH key. Understand that the email you’re using here may be an email provided by you client or company. It may not be the email you normally use.

ssh-keygen -t rsa -b 4096 -C "[email protected]"

There are a few different types of keys you can generate. If you’re interested, GitHub has some good help with SSH keys.

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/rbazinet/.ssh/id_rsa): example_com_id_rsa

I use something specific to the company for who I’m adding the key. You can see here the new SSH key is example_com_id_rsa. Please be careful here, if you leave the default you may overwrite your existing key. You probably don’t want to do that.

The Key is the Config

Head on over to where your SSH keys are stored, probably in ~/.ssh directory. Edit the config file, simple called config. It probably looks like mine:

Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa

Add your additional host. I added mine above the original.

Host git.example.com
Preferredauthentications publickey
IdentityFile ~/.ssh/example_com_id_rsa
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa

The host is the system you need access to. It could be a git server or some other resource. Wildcards work here so if you need to access all resources on s particular domain, you would handle that here. There are a lot of things you can do in the config file and way you do them varies in complexity. If you want a more detailed explanation, Digital Ocean has a good resource.

I hope this helps.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac Tagged With: macOS, ssh keys

Using the Microsoft Ergonomic Keyboard on macOS

April 1, 2020 by Rob Bazinet Leave a Comment

Tweet

IMG 6167

I’ve been through a fair number of keyboards over the years, some expensive and some not. One of my favorites is still the CODE Keyboard, which I wrote about before. I still love this keyboard but I was starting to have pain in my forearms after a long day of typing. I keep coming back to the Microsoft Ergonomic Keyboard to on macOS. Why? Because it’s a tradeoff between being ergonomic and being inexpensive. I’ve seen some other customizable keyboards in the range of $350 but I haven’t found the large price tag necessary.

One annoyance when using many keyboards is the fact that they are setup for Windows operation system and not macOS. This means the Command key is not to the left of the space bar as Mac people expect. The Microsoft Ergonomic keyboard has the Alt key in that location. It’s a simple fix.

Go to System Preferences -> Keyboard -> Modifier Keys…

2020 03 31 10 47 16

Notice the Option Key and Command Key defaults. The Mac is recognizing the Alt key as the Option key. We need to make a change.

MicrosoftKeyboard Before

The easy fix is to swap the two keys in the modifier. Option becomes Command and Command switches to Option. Click OK and everything should work as expected.

MicrosoftKeyboard After

This saved the day with properly mapping the command key. If you need other keys mapped differently on this keyboard, there is another option. Karabiner is a powerful utility for the Mac that allows a wide variety of keyboard mapping. It was more than I needed.

I hope this helps.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac Tagged With: Ergonomic Keyboard, macOS, Microsoft

Fixing TextExpander on macOS 10.14

April 12, 2019 by Rob Bazinet Leave a Comment

Tweet

I use TextExpander from Smile Software every day and rely on it for so many helpful snippets. After upgrading my iMac to macOS Mojave, I realized that TextExpander was broken and nothing I tried worked. It seems TextExpander would no longer expand any snippets. Trying the menu option to “Enable Expansion” did nothing.

I sent a support request to Smile and was really happy to have a response in the matter of an hour. Not surprising, I was not the only one with the issue:

Hi Rob,

Thank you for contacting Smile Support. I’m sorry to hear that you’re having trouble. A few users have reported something similar and these instructions should get it working again:

https://smilesoftware.com/blog/entry/textexpander-macos-10-14-mojave-and-accessibility

After you complete those steps it may also be necessary to click on the TextExpander icon in the menu bar and choose ‘Enable Expansion’. Please let me know if you continue to have trouble.

Maybe this will help someone else with the same problem.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac Tagged With: macOS, textexpander

Speeding up Slow Time Machine Backups on macOS

November 6, 2018 by Rob Bazinet Leave a Comment

Tweet

I’ve been a long-Time Apple Time Machine for many years and it’s saved me many times.

I back up to a Synology NAS drive configured with Time Machine support. Time Machine has always been fast and efficient until I upgraded to macOS El Capitan (10.11). During that time, backups could be measure in hours instead of minutes previously. I initially thought the slowdown had to do with a recent software change in my Synology NAS.

I spent a bit of time in the Synology forums trying to solve the problem with various suggestions from users. Nothing worked.

I upgrade to macOS Sierra (10.12) and High Sierra (10.13) when they came out, hoping something had changed that fixed the agonizingly slow backups. No luck.

Disabling Throttling

I recently started to try to find a solution again since my backups recently went up in size and the slowness was really noticeable. Estimated backup times measured in days. After a bit of digging I found this suggestion, entered in a Terminal window:

sudo sysctl debug.lowpri_throttle_enabled=0

It worked beautifully. A very large backup went from days to hours. Subsequent backups now take minutes instead of hours.

Note: you can re-enable throttling with a similar command:

sudo sysctl debug.lowpri_throttle_enabled=1

I admit I don’t know the side effects of disabling throttling, so use at your own risk.

Making it Stick

If you want to have throttling turned off between Mac restarts, you have to do a bit more work.

Create a file under /Library/LaunchDaemons/fix-el-capitan-slow-time-machine-speed.plist with the contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>fix-el-capitan-slow-time-machine-speed</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/sbin/sysctl</string>
      <string>debug.lowpri_throttle_enabled=0</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

Make it belong to root:

sudo chown root /Library/LaunchDaemons/fix-el-capitan-slow-time-machine-speed.plist

Make it load at startup:

sudo launchctl load /Library/LaunchDaemons/fix-el-capitan-slow-time-machine-speed.plist

Conclusion

I’ve also tested on macOS Mojave (10.14.1) and can confirm a nice speedup. Overall, everything works really well now. I can’t take credit for the solution as I did some searching and came across several places this was mentioned, including one from Apple. I just know that it works!

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac Tagged With: macOS, Synology, Time Machine

Mac Tip: Quick Switch Sound Output

August 12, 2015 by Rob Bazinet Leave a Comment

Tweet

I?ve been an Apple Macintosh user for a long time now, but I often do things the hard way.

I work from home and mix up the work day by listening to podcasts. If the family is around I will put on the headphones as to not disturb them, but some days when I?m alone I remove the headphones and listen through the iMac speakers.?

The obvious way to switch from headphones to internal speakers and back again meant I went to System Preferences->Sound, selected the Output tab and then picked which way I wanted to hear the audio. No, not difficult but there has to be a better way.

It turns out there is (otherwise this post was completely pointless). When you go to the Menu Bar you should see the speaker icon. Clicking on it shows you the volume. Here?s the key..if you hold down the Option key while you click on the speaker icon you get a nice menu:

2015 08 12 09 22 43

There you go switch away, nice and easy. ?Maybe everyone already knew this, but I doubt it.?

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Filed Under: Mac Tagged With: mac, OS X, Tips

Recent Posts

  • How to Fix Rails Flash Rendering When Using Hotwire
  • Hotwire Fix for CORS Error when using Omniauth
  • Fix Installation of Ruby using rbenv on macOS Big Sur
  • RailsConf 2021 and the Future of Conferences
  • Fixing Out of Diskspace Errors on Amazon EC2

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet
@rbazinet

  • Exactly this…. https://t.co/yWj7fZ01HR
    about 16 hours ago
  • https://t.co/EmagdpLoNv "Introducing GitHub Copilot X · GitHub"
    about 1 day ago
  • RIP Gordon Moore: https://t.co/c5J9LaHrj8
    about 1 day ago
  • Our daughter works as a teaching assistant at a local K-8 public school. It’s become apparent that students today r… https://t.co/p2t912GVyc
    about 2 days ago
  • Working to wrap up my current consulting gig by mid-April. I will be looking for the next thing soon. If anyone has… https://t.co/sg3cSV9yqM
    about 3 days ago
  • RSS - Posts
  • RSS - Comments
Find me on Mastodon