Ever since Lion, Mac OS X 10.7, there has been a great and very underrated feature built-in to every Mac: the ability to highlight some text and have macOS turn it into an audio file.
This is a wonderful way to listen to written text while you’re on the go, or if you want to skim through text you or others have written while you’re occupied with another activity, such as walking or driving. I love this feature!
I’ve seen the option in the context menu many times, but I’ve never dared to use it until today. Perhaps I held off for so long because the option reads “add to iTunes as Spoken Track” – and I’m just not a big fan of iTunes.
Turns out, this text-to-audio option bypasses iTunes altogether. It doesn’t open automatically and we won’t need it to transfer tracks to our iPhones either. What a relief!
Yesterday I had to transcode some audio files recorded with Quicktime on macOS. Quicktime works great for that, but it only stores files in its native AIFC file format. That’s the Audio Interchange File Format, a format developed by Apple in 1988, storing audio data as uncompressed PCM data.
Sadly though, AIFC is not commonly readable by many applications, and as such the data needs to be transcoded to be used successfully elsewhere. And Quicktime offers that option too, simply by choosing File – Export – Audio Only. This will create an MPEG 4 audio file with the M4A extension.
While that file sounds fine, and its size is only a fraction of what the original AIFC file was, this transcoding process does not allow us to choose which compression algorithm to use upon export. As it turns out, Quicktime introduces a very good, albeit lossy compression when it exports files in this manner.
I wondered if there was a way to extract uncompressed lossless data from the AIFC file, and how to do it. If Quicktime didn’t let me, perhaps there was another way, maybe using some kind of free software tool.
All we have to do is open a Finder window, right-click the AIFC file in question, and select Encode Selected Files at the bottom of the context menu. We can even select multiple files and transcode them all at once.
When we do that, a dialogue window comes up. This may take a moment or two, so don’t get nervous if your Mac doesn’t respond instantly to this request (like I did).
Now we get options! We can pick destination for our new files, and we even get the choice to delete the original AIFC file if we so desire (and if we’re confident enough about this workflow’s capabilities).
The best option we get though is that we can pick how the file(s) are to be transcoded though. While we do not get these options during the Quicktime export process, which appears to use the “High Quality” setting (and probably the same tool under the hood), with Finder we can choose the Apple Lossless codec.
From what I understand, all three options apply a lossy AAC compression in varying degrees, resulting in different file sizes, data rates and of course different levels of quality. The only one that stands out is the Apple Lossless setting, which creates a file still smaller than the AIFC file, but with lossless compression, in M4A format.
The resulting M4A output is readable by a wide range of applications.
Thanks, Finder! I didn’t know you did Audio Encoding so well 🙂
Did you know you can run Commodore BASIC v2 on your Mac and Linux systems as a scripting language? It’s true – thanks to the marvellous efforts of Michael Steil and James Abbatiello. They’ve adapted the original BASIC v2 as featured on the VIC-20 and C64 with additional routines so that it works natively on modern machines. It’s ingenious!
For those who don’t quite know what to do with it, here are some instructions that’ll help you get CBM BASIC up and running on macOS.
GitHub provides a convenient way to either clone a repository on your local machine if you have GitHub for Desktop installed, or you can download a ZIP file and unZIP it somewhere on your system. Once done, you should see a directory structure that looks exactly like the repo on GitHub.
You need a few utilities installed your your Mac to be able to compile files. Downloading Xcode will ptovide you with an excellent (and free) IDE as well as the command line tools needed to do that (gcc, make and several other goodies). You might be able to bring those components in using the Homebrew package manager.
Using your Terminal app, navigate to your unZIPped folder. It includes a MAKEFILE so there’s no need to mess with any parameters. Enter “make” at the command prompt, and after a few moments you should have a file called “cbmbasic” without an extension in the same directory. That’s the binary for your Mac.
To make it executable, we’ll have to tweak the file permissions – otherwise our operating system won’t be able to run it. We’ll do it using the chmod command:
You can test if it works by calling the binary without any parameters like this:
If all goes well you should see something like this:
For easy access, copy the binary over to your /usr/bin directory. That’s where common command line utilities are installed on Mac and Linux systems. The added benefit is that the path to that folder is already in your local $PATH variable, and as such you can simply type “cbmbasic” from any location when you’re on the command line.
Here’s how to copy the binary over (this will ask for your administrator password):
Using Direct Mode
When you run the binary it will bring up something like the standard BASIC command prompt we’re used to seeing on the Commodore 64. There are however a few important differences between a C64 emulator and this implementation:
this is NOT an emulator
cursor keys DO NOT work
all commands typed in must be CAPITALISED
Other than that, you can start typing like on a real machine. Be careful with certain POKE commands though as those may call system routines that might not be implemented.
LOAD and SAVE commands have been tweaked to reference the command line structure. They work just fine, but will load and save files in Commodore file format (which is not clear text ASCII – more on that later). For example:
The above displays the directory of the current folder, much like it was an attached floppy drive. How cool is that? You can reference folders using both LOAD and SAVE just as if you were on the command line.
You can also type in programmes and run them – however the cursor keys won’t work, so there’s no screen editing options. Programmes SAVEd from direct mode cannot be loaded from the command line, only from direct mode (i.e. when launching the binary without parameters).
To quit direct mode, hit CTRL+C.
Running Programmes from the Command Line
The real power of this implementation can be seen when we run files from the command line. Those files must not be SAVEd from direct mode, but instead are simple clear text files. The extension doesn’t matter, but for good practice, let’s store them as .BAS files (much like shell scripts are stored with the.SH extension, or PHP files would be stored with the .PHP extension… you get the idea).
You can write standard BASIC programmes use your favourite text editor (like vi from the command line), or try one from the “test” directory that’s provided with the repository.
Imagine we had a file called “hello.bas” that we’ve created with vi, looking like this:
To run our file, we can simply define it behind the binary like this:
This will greet us with the “Hello World” message on the command line.
Running Script Files
Alternatively, we can specify the full path to cbmbasic at the beginning of a file (she-bang notation) and run it just like any other script file. Observe please:
If the file was called “hello”, we’d need to change the permissions again so that the file can be executed:
Now we can run it like this:
Sweet – but I can’t work out how to compile this on macOS…
Fear not – I’ve got a macOS binary that was compiled on 10.12 “Sierra”. You can find it in my fork of the project. Check out the “binaries” folder.
Does it work on Windows? Or on Linux?
I’ve tested compiling and running this puppy on CentOS 6 and 7 with roaring success. The above steps worked fine for it, so I’m assuming it’ll work on other Linux flavours just as well (the beauty of portable C code).
According to the author, it works fine on Windows too – however I have no idea how to compile source code on Windows, so you’ll have to figure that out for yourself. I hear good things about Visual Studio – if I work out how to do it, I’ll add it to the “binaries” folder on my GitHub Fork.
Can I write my own extensions to BASIC?
Apparently so – check our Michael’s site and repo for details:
Right now, if you run SYS 1 from direct mode first, you can use the SYSTEM command (followed by anything you’d like to execute on the command line in “double quotes”) as well as LOCATE (followed by an x and y coordinate to place the text cursor) and WAIT.
Have fun hacking BASIC and letting it run with the blistering speed of modern CPUs 🙂
Not only is Xcode an excellent IDE for iOS and macOS apps in both Swift and Objective-C; it does just as fine a job for regular C and C++ code. This includes all the features we know and love, such as code completion, version control, and all the rest of it.
Let’s see how to use Xcode 8.3 for C and C++ development.
Something rather strange happened to me today: Safari 10 on macOS Sierra refused to let me login to YouTube. All it did was constantly refresh the page in an endless loop, or just display the front page of YouTube. I cleared the caches, reset the history, but no trick seemed to solve the problem.
When I dug deeper into the Preferences, I found something under Privacy that finally fixed it. Let me share with you what worked on my system.
head over to Safari – Preferences
select the Privacy tab
you’ll see a window like this one:
select Manage Website Data
after a few moments you’ll see a LONG list of websites that have saved cookies on your machine over time
in the top right corner, search for YouTube
you’ll see something like this:
select the YouTube.com entry and hit Remove, followed by Done
now surf back to YouTube and login – this time it’ll work
What we’ve just removed were not just cookies, but also HTML local storage data, as well as cache data specific to the YouTube website. I guess cached stuff can get outdated, or not properly deleted when we close our browser in a hurry.
The principle should work for other websites too, should they give you trouble. If you’re sick and tired of any website saving data to your system, consider switching to the “Always Block” option seen in the first screen shot.
Unmounting external drives on a Mac is usually done quick and simple by either dragging drive icon to the trash, or by using the eject symbol in a Finder window. Mounting usually happens automatically when a new drive is inserted into a USB port or SD card slot.
However, there is a way to do this via the command line, of which I am a big fan. Fire up a Terminal session and see how to do it.
Listing available drives
To see what’s currently attached to your Mac, let’s use the diskutil command, followed by the word list. You’ll see output like this:
#: TYPE NAME SIZE IDENTIFIER
#: TYPE NAME SIZE IDENTIFIER
#: TYPE NAME SIZE IDENTIFIER
Attached drives are listed with their physical locations on the left (i.e. /dev/disk0, /dev/disk1, etc), as well as with their respective partitions if available on the right (like disk0s1, disk1s2, etc). Make a mental note of the latter: you’ll see that we have a physical disk (like disk0), on which several partitions may have been created. It is those partitions we’ll mount and unmount, NOT the physical drive.
Unmounting an attached hard drive
On my system I have two internal hard disks (disk0 and disk1), and one external USB drive (disk2). Let’s unmount that USB drive now:
VolumeVMDriveon disk2s1 unmounted
Note how we use the unmount command. We need to specify the location of the partition with its full path (i.e. /dev/disk2s1).
Mounting an attached hard drive
To mount the drive again, without having to take it out and plugging it in again, I can issue this command:
The Logitech M325 and M325c are both wireless USB mice. Their design appears to be identical (except for the many different colourful variations of course), and their prices vary from anything between $12 and $60 – depending the layout and seller. Even the packaging is identical.
So what’s the difference between these two models? Is it precision? Is it the build quality? Is it the year of production? Is it something else?
Actually no, the two mice are absolutely identical and both work with Windows, macOS and Linux. The only difference is in the wireless receiver that Logitech give you with each model.
The difference is the wireless receiver
The M325 comes with a Logitech Unifying Receiver. You can tell by the little “sunshine” logo on the side. This type of receiver allows us to use the Logitech Unifying Software to operate several devices over a single receiver (say a mouse and a keyboard). It’s a little clunky to setup more than one device, but it certainly saves valuable USB slots on your machine.
Note that for this to work, all decides must be Logitech unifying devices, and all must display that little sunshine logo.
The M325c on the other hand does NOT come with a unifying receiver, and instead comes with a standard USB receiver. Only this one device will work with said receiver. As you can imagine, the receiver does not bear the unifying logo on the side. Therefore you may find the M325c a little cheaper than the M325.
Note however that the M325c mouse itself IS a unifying device, and it DOES bear the unifying logo on the underside. Hence you can use the M325c mouse with another unifying receiver just fine.
So there you have it – that’s the big secret difference between these two mice. I have both, and I couldn’t tell the difference at first. The mice are identical, just the USB receiver is a little different. Just in case this question was driving you crazy too 🙂
I’ve recently bought a new Logitech K360 keyboard for my HP Z600 workstation. I also had a Logitech M325 mouse, both of which came with Unifying USB receivers. I could plug both receivers in, and both devices would work great.
However, I heard good things about these little receivers and wanted to free up a USB port, and thought I’d connect both devices to the same receiver. Apparently you can connect up to 6 devices to one receiver and store any spare ones inside the mouse or keyboard. Being an all-efficient belt-and-braces kinda guy, I tried my luck.
Turns out it was relatively easy to pair both devices to the same receiver, thanks to a small piece of software that can be found here, along with instructions on how to use it:
It all worked fine on my Windows 10 machine, until I wanted to use the mouse (not the keyboard) with my Mac. I know, it’s exotic, and perhaps I should have just bought another mouse. But there’s only so much space on my desk, and I really don’t need more clutter in front of me for just an occasional switch.
In this episode I’ll show you how to launch a Mac App from the Command Line, so that we can pass parameters. I’ll also explain how to wrap up such a command into your own app and add an icon to it, so that you can launch it from the dock with a single click.
This can be useful if you need to convince Google Chrome or any other app to launch with certain parameters and modify its behaviour somehow. In my example I’m using Blender, and I’m using a startup parameter to change its default render engine upon launch. The same principles apply to any app you need to launch with startup parameters.
The process is as follows:
find out the full path of the app you want to launch
try launching your app from the command line
now add parameters to the end of the launch command
create an Automator App
change its icon from from the generic Otto Icon to your desired app’s icon
Sometimes it’s’ necessary for us to force-close an app on our Mac if it’s no longer responding to our commands. Usually we’d do that by pressing CMD+OPT+ESCAPE, which brings up a handy window from which we can choose a troublesome app.
But sometimes, this keyboard combination won’t work – for example, if we’re dealing with a remote Mac to which no physical keyboard is attached. In such cases, we can choose to force-close an app via the command line. Let me show you how to do that.
Connect to your Mac via SSH using a Terminal Session and find out what apps are currently running. We’ll so that with the top command:
Using the -u switch tells top to list the app with the highest CPU usage over time first. The command will display a list of running processes, much like this:
Take a look at the list and make a note of the troublesome app. In my case it’s Carrara, using 165% of my CPUs resources. By definition impossible, but let’s not worry about that. The important thing is this app’s PID (Process ID). Write it down or take a screenshot, we’ll need it in amount to kill the app (mine is 5964).
Press CTRL+C to stop top and return to the command line. Now issue the following command, replacing 5964 with your own PID:
And that’s it: the troublesome app has been force-closed and should vacate your system sharpishly. For more information on both top and kill, check out their respective man pages on your Mac.