Mac How To: Microsoft Outlook for Mac Profile Switching

Outlook for Windows supports profile switching at launch natively, but the version for macOS makes it a little more difficult. Microsoft does, however, include a profile switching utility within Outlook for Mac and with some AppleScript you can launch the switching utility before Outlook. It’s not as seamless as Outlook on Windows, but it’s better than nothing! This script checks Outlook is closed (and quits it if it’s open), launches the profile switching tool, waits for you to change your default profile and close the tool, and then finally launches Outlook.

To get started, open up AppleScript editor (Applications > Utilities > Script Editor), and paste in the following:

set Outlook to "Applications/Microsoft Outlook.app"
set ProfSwitch to "Applications/Microsoft Outlook.app/Contents/SharedSupport/Outlook Profile Manager.app"
if application Outlook is running then
	tell application Outlook to quit
end if
tell application ProfSwitch to launch
repeat until application ProfSwitch is not running
end repeat
if application ProfSwitch is running then
	delay 1
end if
tell application Outlook to launch

Once you’ve pasted the code into the AppleScript Script Editor, go to File > Export. Name the file, pick the directory, change the File Format to Application, tick ‘Run Only’ and then click Export. Now you can save this into your Applications folder and pin it to your dock. 

Each time you launch, you can change the default profile Outlook should open with, and once you make the change and close the utility Outlook will launch with the correct profile.

ASCII Art featured image

Cheat-sheet: Linux Commands in Windows

If you spend a lot of time in the command line you may find it a bit difficult to remember the different commands you need to use to achieve basic things depending on whether you’re using Unix/Linux or Windows that day. This guide contains a cheat-sheet with some of the most used Unix commands and their Windows counterparts. If you use PowerShell you’re in luck because Microsoft has added a large number of the Unix commands as aliases for their Windows counterparts for you, but if you use CMD/Command Prompt still this list is for you.

 

Cheat-sheet:

Unix command: clear
CMD command: cls
The clear command is used to clear the window you currently have open, useful if the clutter is distracting you. The Windows alternative is cls (clear screen).

 

Unix command: ls
CMD command: dir
The ls command is used list the contents of the current directory, append with the location of another directory to list the contents of a different directory. The Windows alternative is dir (directory).

 

Unix command: cat
CMD command: type
cat is most frequently used to output the content of a file to the command line, or to add the content of file into another file. The Windows alternative is type (fairly self explanatory).

 

Unix command: sudo
CMD command: powershell Start-Process cmd.exe -Verb runAs
Windows doesn’t have an in-built answer to the sudo command (used to elevate your command line to run commands that are system sensitive), but powershell Start-Process cmd.exe -Verb runAs will open another CMD window for you running as the administrator user.

 

Unix command: rm
CMD command: del
Used to remove files and folders. The Windows alternative is del (delete).

 

Unix command: cp
CMD command: copy
Used to copy files and folders. The Windows alternative is copy (self explantory). xcopy also exists.

 

Unix command: nano, vi, ee
CMD command: notepad
CMD doesn’t have an in-built text editor*, but prefixing a file name with notepad will open it up in Notepad so you can edit it in the GUI. If you need to open a file as an Administrator (for example to edit the hosts file), see the next command.
* Some older versions of Windows come with edit from the DOS days, but Windows 7 64-bit and above does not.

 

Unix command: sudo nano
CMD command: powershell Start-Process “notepad.exe <filename>” -Verb runAs
This will open the file you want to edit in an elevated Notepad instance. For example, to edit the hosts file run: powershell Start-Process “notepad.exe C:\Windows\System32\drivers\etc\hosts” -Verb runAs and then you can make the changes needed and save the file in the GUI.

 

Unix command: ssh
CMD command: ssh
Windows 10 supports SSH! (Version 1809 does, anyway – older versions probably do too).

 

Unix command: shutdown (and shutdown -r or reboot) 
CMD command: shutdown
Windows supports the shutdown command but the flags are slightly different. Replace the hyphen with a forward slash (e.g; rebooting on Windows requires shutdown /r instead of shutdown -r). Execute shutdown and CMD will display a list of arguments.

Settings

Mac How To: How to stop accidentally quitting apps

If you’ve ever accidentally pressed CMD+Q and quit an app when you wanted to press CMD+W to close a tab or the window, you can easily re-map the key combination required to quit a specific app (or all apps) in Settings. 

To do this open Settings, head to Keyboard, and then Shortcuts.

Then select App Shortcuts from the list on the left and then press the icon

Settings

If you wish to remap the key required to quit a specific app enter the following:

Application: Select the app you want to change (e.g; Safari).
Menu Title: Type Quit
Keyboard Shortcut: Click in this box and press the new key combination you wish to use to quit apps.

Click Add and then quit and re-open the app you’ve changed the shortcut for.

Safari

If you wish to remap the key required to quit all apps enter the following:

Application: Leave All Applications selected
Menu Title: Type Quit
Keyboard Shortcut: Click in this box and press the new key combination you wish to use to quit apps.

Click Add and then reboot. 

All Apps

macOS How To: Enable AAC and aptX Bluetooth Audio Codecs

By default, macOS defaults to the SBC audio codec for Bluetooth headphones regardless of whether your headphones supports AAC or aptX. macOS itself, however, does support these codecs, it just needs enabling.

In my case, I am using the Bang & Olufsen Beoplay H9i that support the AAC codec, but this guide also includes a step for aptX for any headphones that support it.

To see what codec your Mac is currently using for audio on your headphones, hold down the option key on your keyboard, and click on the Bluetooth icon in the menu bar. Once the menu has popped up, move the mouse cursor down to the connected device and it will pop out another menu displaying the currently used codec:

Bluetooth Menu showing Beoplay H9i connected with SBC

If the Active Codec: is shown as SBC and your headphones support AAC or aptX, you’ll be able to enable the correct codecs with the following commands in Terminal (you’ll need administrator access on your account). Turn off your headphones before doing this (not doing so shouldn’t cause any harm, but it’s just easier).

To enable AAC:

sudo defaults write bluetoothaudiod "Enable AAC codec" -bool true

To enable aptX:

sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true

Then run the following command and you should see the following settings afterwards:

sudo defaults read bluetoothaudiod

The above command should show the following:

Jons-MacBook-Pro:~ jonprocter$ sudo defaults read bluetoothaudiod
{
    "Enable AAC codec" = 1;
    "Enable AptX codec" = 1;
}
Jons-MacBook-Pro:~ jonprocter$ 

Once that is done, you can now re-connect your headphones. Once reconnected, start playing some audio and then go back to the Bluetooth menu (holding down the Option key again) and you should see the following (with aptX in place of AAC if your headphones support it):

Bluetooth Menu showing Beoplay H9i connected with AAC

If needed, you can disable AAC and/or aptX again using the following:

To disable AAC:

sudo defaults write bluetoothaudiod "Enable AAC codec" -bool false

To disable aptX:

sudo defaults write bluetoothaudiod "Enable AptX codec" -bool false

macOS How To: Update your Mac in Terminal

When updating your Mac, you usually have to go through the App Store to do it. This can be annoying because it takes around 20 minutes to do each update and you can’t use your Mac at the same time. But did you know there’s a way to do it via the command line interface?

The utility you can use to do this is called ‘softwareupdate’ and it’s pretty powerful, but we only need one command to check for and install updates:

softwareupdate -ia

If you’re interested in the other features this utility offers, you can run:

softwareupdate -?

Tips:

If you’re interested in being able to check for updates and install them and then reboot automatically afterwards you can add the following line to your ~/.bash_profile file with your favourite text editor such as ee, vim, or nano.

alias update='sudo sh -c "softwareupdate -ia && reboot"'

Then save and exit the file and run the following to re-load your .bash_profile file.

source ~/.bash_profile

macOS How To: Use Touch ID to authenticate as sudo in Terminal

TL;DR: 

To authenticate as sudo in Terminal, paste the following line into /etc/pam.d/sudo

auth       sufficient     pam_tid.so
Step-by-step Instructions:

Firstly you’ll need to open /etc/pam.d/sudo in a file editor within Terminal. You can do this by running the following command:

sudo vi /etc/pam.d/sudo

Then, press the key on your keyboard, this will allow you to insert text.

Then, paste the following line into the file – you’ll need to use the keyboard for navigating around the file, but you can use the right click context menu to paste (or CMD or Edit > Paste).

I made a new line below the first line, but it can go anywhere as long as it’s on a new line:

auth       sufficient     pam_tid.so

Then, press the escape key on your keyboard. Then type :wq! and press enter. This will save the changes to the file.

Lastly, quit Terminal by pressing CMD + Q. Then relaunch Terminal and run a command as sudo (e.g; sudo -i to change to root in Terminal) to test.

macOS How To: Bypass Gatekeeper for “App cannot be opened. You should move it to trash.”

To bypass Gatekeeper and open an app when “App cannot be opened. You should move it to trash.” comes up, simply open Terminal (Applications > Utilities > Terminal) and run the following command:

sudo xattr -r -d com.apple.quarantine /Applications/name of app.app

You’ll need to replace name of app.app with the name of the application you’re trying to open.

You can find this out by going to the Applications folder and finding the first few letters of the app name, you can then auto-complete the name in Terminal by pressing the tab key (above Capslock) in Terminal after typing the first few letters of the name of your app.

Example: Type the following, and then press tab:

sudo xattr -r -d com.apple.quarantine /Applications/Microsoft Wor

macOS will autocomplete it to:

sudo xattr -r -d com.apple.quarantine /Applications/Microsoft Word.app

Mac How To: Find Your Mac’s Processor/CPU Model Number

On macOS, going to the System Profiler doesn’t give you the exact model number of your CPU, rather it just gives you the clock speed and the CPU branding (e.g; Intel Core i7).

You can, however, use Terminal to find the exact model number of your CPU. Just open up Terminal (Applications > Utilities > Terminal or use Spotlight to search for it) and run the following command:

sysctl -n machdep.cpu.brand_string

Mac How To – Allow Apps Downloaded from Anywhere in Sierra

It appears that Apple have removed the ability to enable Allow apps downloaded from: Anywhere from within System Preferences.

Fortunately, it’s easy enough to enable with 1 line in a terminal window. This line will enable and set the Allow apps downloaded from: preference to Anywhere.

sudo spctl --master-disable

Once you’ve run the command, close down System Preferences and then open it up again.

Continue reading

Mac How To: Prevent your Mac from sleeping with Terminal

From time to time you may want to prevent your Mac from sleeping without having to go into Settings and turn off Energy Saving mode.

Thankfully, there’s another way to keep your Mac awake. All you need to do is run a single command in Terminal called caffeinate.

Continue reading