I recently upgraded to macOS Catalina (10.15 public beta). There are several “under the hood” changes to the Unix underpinnings which may trip people up. I’m comfortable at the command line but by no means an expert so this post is mainly designed as a reference for future me.
You’ll probably notice the first change when you launch Terminal. If your default shell is set to Bash you will receive the following warning every time:
The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit [https://support.apple.com/kb/HT208050](https://support.apple.com/kb/HT208050).
FWIW, I think this is an excellent warning message… it states the “problem”, provides instructions on how to fix it and links to a much more detailed article with more information (including how to suppress the warning if you want to use the ancient version of Bash that’s bundled with macOS for some reason).
Personally, I took the opportunity of changing shells to switch to fish shell again. I used it on my last computer but hadn’t bothered to set it up again on this one. It’s a lot less similar to Bash than Zsh but most of the time that’s a good thing (Bash can be quite cryptic and inconsistent). On those occasions where a tool or StackOverflow post doesn’t have fish instructions (and I can’t figure out the fish equivalent myself) it’s usually a simple matter of running
bin/zsh now) to temporarily switch to a supported shell.
The next change you might notice is when you go to use a Ruby executable (e.g.
irb). The first time I ran it I received this warning:
WARNING: This version of ruby is included in macOS for compatibility with legacy software. In future versions of macOS the ruby runtime will not be available by default, and may require you to install an additional package.
I was a little surprised by this one, not that Ruby was being deprecated (that got a fair bit of coverage in the nerd circles I move in), but because I knew I had installed rbenv, and the latest version of Ruby through that, prior to upgrading to Catalina.
Thankfully the excellent rbenv README had a section on how rbenv works with the
PATH and the shims rbenv needs at the start of your
PATH for it to work properly.
After changing shells (to Zsh or fish), there’s a good chance that whatever technique you previously used to modify your
PATH when your shell session starts is no longer in effect in your new shell.
The README says to run
rbenv shell to fix it, however on my machine (regardless of shell) I kept getting a warning that it’s unsupported and to run
rbenv init for instructions. You should probably do the same (in case the instructions get updated) but at the time of writing the instructions
rbenv init gave for various shells are:
# fish: > rbenv init # Load rbenv automatically by appending # the following to ~/.config/fish/config.fish: status --is-interactive; and source (rbenv init -|psub) # Zsh: % rbenv init # Load rbenv automatically by appending # the following to ~/.zshrc: eval "$(rbenv init -)" # Bash: $ rbenv init # Load rbenv automatically by appending # the following to ~/.bash_profile: eval "$(rbenv init -)"
Once you restart your terminal window you should be able to confirm that rbenv is handling ruby versions (via its shims) for you:
> which ruby /Users/matthew/.rbenv/shims/ruby > ruby -v ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin18]
I used Sign In With Apple for the first time today in the beta version of Micro.blog
As a customer it was quick, clear and put me in control of what info I shared without being fiddly.
For companies, I suspect it will make customer support a bit trickier though.
I’ve been enjoying listening to www.founderquestpodcast.com lately…
3 devs who launched a successful product/company but are optimising for profit rather than growth. I like their down to earth outlook and pragmatic approach (& guerilla marketing 🙂)
I recently finished listening to The President is Missing by Bill Clinton and James Patterson (while doing some work in the back yard). 📖 🎧
It was pretty good… not amazing but enjoyable nonetheless.
Web developers: if your password field doesn’t let my browser auto-generate a unique password and doesn’t let me right-click on it to paste a generated password in, you’re doing your job very wrong
(I’m looking at you “Smart”sheet)
I wish I’d known about
.rubocop_todo.yml last time I experimented with adding RuboCop to an existing codebase!
I used draw.io again today for a flowchart. It’s no OmniGraffle but it’s pretty amazing how good a client-side web app can be, especially considering it’s free (and ad-free)!
When writing change logs, commit messages, code comments, method names, project plans or just about anything else, don’t forget to explain why.
Whoever is reading it (future you?) can probably figure out what you did… but understanding why is much harder and way more valuable!
It has taken me 5 days to knock down our old back fence and put in 7 new fence posts. Tomorrow I hope to finish the rails (and maybe start on the palings). Tuesday I hope to finish the palings.
And then I hope to never build a fence again!
Embrace the conceptual compression of Rails… Don’t think you need to understand everything from day 1 — DHH
Still something I struggle with. So easy to focus on all the things I haven’t yet learned!
All Micro.blog hosted blogs now come with free sandpit blog so you can try out theme and design changes! 🥳🎉
I just added my vote for a Micro dot blog icon to be added to FontAwesome:
The circle of life continues:
Project Zero released details of a sustained (multi-year) and regularly updated iOS exploit suite.
I could barely follow a sentence of the iOS exploit chain articles but the last post demonstrating the capability of the implant is terrifying.
Even though the implant wouldn’t survive a reboot, by then the attacker (and anyone who happened to be listening to the unencrypted network traffic the malware sent back) already has your entire keychain.
As the author points out, this is a failed (detected/patched) exploit… it’s possible there are others still out there.
Xero doesn’t support line items that have a mix of GST and non-GST items. To add a mixed invoice you have to add the taxable amount on one line and the non-taxable amount on another. Unfortunately many invoices simply provide the total amount paid and the GST included, which means doing the calculations (estimations) yourself.
Most of the time you can just multiply the GST paid by 10 to find out the taxable portion and use that to derive the exempt portion:
# converted to cents for simplicity total = 9794 gst = 566 taxable = gst * 10 # => 5660 exempt = total - gst - taxable # => 3568
In this case I happen to know the “correct” amounts were actually $56.65 taxable and $35.63 exempt but we can’t know that for sure based on the inputs we were provided. Our calculated answers are within the range of valid solutions and everything adds up correctly.
However, this formula doesn’t handle some (legal) edge cases. On a $9 invoice with $0.82 GST we end up with a taxable portion of $8.20 and an exempt portion of -$0.02. It’s an easy mistake to make.
To correctly derive valid values for the taxable and exempt portions in this case we need to add a conditional:
total = 900 gst = 82 taxable = gst * 10 # 820 if taxable + gst > total taxable = total - gst # 818 end exempt = total - gst - taxable
Fantastic interview with Sandi Metz. There were two things she said that I wanted to write down but I was driving. No matter, I will happily listen to it again!
This hardening guide for Rails apps is big but clearly written and has lots of links if you need more information about any steps. Bookmarking for future reference!
Swedish school district in privacy hot water after tracking student attendance using facial recognition.
It’s getting easier and easier to do!
“There is no quick fix, but there is a fix”
Something to remember with relationships, work and learning new skills… tricky lesson to learn though!
So apparently Stripe has 45 developers…
…whose entire job is inwards focused, trying to make the developer experience better for the rest of the development team! 🤯
How not to write error messages:
>[Error] Script lines: 1-9 -------------------------- An unexpected token "" was found following "". Expected tokens may include: " table_name".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.22.29
Today I learned that
bundle open is a way to easily look inside Ruby gems!