HOME BLOG

Archive for the ‘macOS’ Category

How to check if a package is installed with Homebrew

Posted on: July 23rd, 2023 by Olu No Comments

Hi folks,

In this post I cover a tip for checking if a pacakge is installed with Homebrew. Homebrew is a free and open-source package management system. That is, it is a tool for managing installation of software on macOS and Linux.

Here’s the command:

brew list <packagename>

That’s all for now. Till next time, happy software development.

How to find files in a folder while excluding those in certain subfolders

Posted on: March 11th, 2021 by Olu No Comments

Hi folks,

Recently in the course of work I had to find lots of files in a certain folder while excluding files in certain subfolders. I had to do a bit of research on how to do this in Linux-like environments. So I thought I’ll share.

So, let’s assume that in the current directory there are subdirectories s1, s2, s3, etc., each containing .txt files. Now assume you want to recursively find all .txt files in the current directory, but exclude all those in s2 and s3 subdirectories.

Here’s a command you can use to accomplish this using the find command.

 

find . -name '*.txt' -not \( -path './sub2/*' -o -path './sub3/*' \)

 

Note that the -o means OR logic. The \( and \) allows us wrap multiple conditions together to form a compound condition and the -not means NOT logic. Also of interest is the -path flag which allows you to match a pattern in the path of a file.

That’s all for now. Till next time, happy software development.

How to make MacOS Remember your SSH Passphrase

Posted on: February 18th, 2018 by Olu No Comments

Hi folks,

Here’s a quick tip on how to make your macOS remember SSH passphrases. If you use public/private key authentication to access servers, you probably wouldn’t want to have to enter the passphrase every time you access the server. To make your client store the passphrase, all you have to do is enter the following into  ~/.ssh/config



Host *
    UseKeychain yes


Once you do this, you would need to enter the passphrase once and afterwards it will be remembered. This was tested on macOS High Sierra.

That’s all for now. Happy coding.

 

Sources

macOS keeps asking my ssh passphrase since I updated to Sierra. https://superuser.com/questions/1127067/macos-keeps-asking-my-ssh-passphrase-since-i-updated-to-sierra