We dive into the macOS Terminal and use Homebrew’s best utilities and tricks.
All Homebrew commands –
Follow me on Twitter –
Follow me on Instagram –
this episode of our Mac tip series is a little bit more advanced but fear not because I'm here to help you through it I'm introducing you to the command line and homebrew tools designed primarily for developers but with a few really cool options and utilities for Mojo's like you and I let's get started everything we're going to be doing today takes place inside of the command line or terminal if you never use terminal before you can navigate to applications and then the utilities subfolder and you'll find it inside or you can search it via a spotlight once you open terminal you'll find a window that looks something like this now before we can do anything with homebrew we actually need to install it and so if you've installed the Xcode tools before you will be able to skip this step if you haven't you'll most likely haven't type the following command Xcode – select space – – install by the way for the record if you miss one of these commands and you probably will they're all linked down below in raw text so you can actually copy and paste them into the terminal window really easily so I get an error because my command-line tools have already been installed if you haven't installed them yet you'll be prompted to do so and that takes a couple of minutes once we've installed those tools we can actually install homebrew now this is a long command so I would recommend copying and pasting but once you paste it it's going to ask you if you want to continue by pressing return we will say yes we'll need to give it our admin password on our Mac and then it's gonna go to town this also takes a couple of minutes once we have the Xcode select tools and homebrew installed it's ready to get messing around with some cool utilities so let's start it off the first utility we're going to talk about is called cask cask is incredibly powerful it allows you to download install maintain updates and uninstall non Mac App Store applications there's a lot of apps for Mac and a lot of them are not on the Mac App Store this utility cask allows you to basically maintain them without having to go online and Google the file and download the file and then install it through the installer and then make sure it stays updated and get babar no no cask does all of that for you it's one of my favorite utilities and it's super super powerful to install it you just type install cask and homebrew will fetch the package file and install it for you it can take a couple of seconds now that cask is installed we can start working with it now I should know that all of these utilities are insanely powerful and I couldn't possibly talk about everything they're capable of in this video so if you ever want to know what they can do or if you ever get stuck type brew for homebrew then the name of the package or utility you're trying to use so in this case cask and then type help and a list of commands along with descriptions on what those commands do will pop up and show you basically how to use it so first of all let's do brew search casks this will show us the entire catalog or list of hundreds of casks that are available to us so you can see just how insanely I mean there are tons and tons of Mac apps that are listed in this section that you can install using cask now this isn't very helpful sorting through this big massive list so there's a built-in search functionality from within cask you can type brew search and then the name of an app so let's say I don't know discord we type enter cask we'll try and locate that package and if it returns a result you can see there you go there's the discord app that we need to install so if we want to actually install discord we can type brew cask install and discord and it will download that package and install it for us really pretty awesome so it's downloading it right now it will install it without ever you popping up an installer file so once we get to the end no installation it does it all automatically and then if we open spotlight and type discord there it is that's pretty awesome isn't it now if you want to update stuff I can type brew cask and then upgrade and that will upgrade every single application that is installed using cask on my Mac and you can see because I've only installed discord and it's already up to date there's no casks to upgrade but this is a super amazing option if you ever have a lot of apps that are always bomb barring you for updates especially the crappy apps that take you back to Safari to redownload the app and it's built it's awful just use cask ii utility is kind of a strange one but it's a really cool one it's called each top so you've probably used Activity Monitor before and if you haven't well this is activity monitor if your computer is slowing down or whatever you can kind of see what the different processes are and kill them directly from this application it also shows you your cpu load how much memory you're using stuff like that but this application I don't know I've never found it to be well laid out and it doesn't show you graphically how much resources you're using and so H top is a really really great alternative you can install it by typing brew install H top and it will download and install it once it's installed we can type sudo H top now we need to use super user privileges it's gonna ask for our password because we are actually monitoring the hardware on the Mac which Mac OS requires hardware level permissions for so once we enter that it will show us this very cool representation of how our system resources are being used you can actually see the per thread usage on my 8 core 16 thread CPU you can see a graphical representation of how much memory is being used you know so see your uptime the number of tasks and you can manage filter search and kill tasks all from this window using the function keys it's really really powerful and really awesome if you're trying to seed out or find some little spooky application that's consuming more resources than it should each top is pretty slick next speedtest.net sometimes you need to run a speed test but going to speedtest.net is a real nightmare they have a crappy website it uses tons of resources it's just bad well you can do that from the command line if you type through install speed test – CLI for command-line interface it will install and once it's installed we can enter speed test CLI and it will actually run a speedtest.net speed test without having to navigate to the web browser you don't have to load the massive webpage and have the ads on the side it's all done directly through the command line which is pretty slick so right now it's testing my download speed that has finished it will test my upload speed and it will tell me the results yes my office Internet is pretty crappy are these getting a bit too out into the woods for you alright let's take it back to an easy one this is youtube-dl it's pretty simple youtube download that's right you can install it by typing brew install you too – do you're also going to need to install ffmpeg if you want to download videos in a resolution above 720p which you probably do so type brew install youtube – dl and then ffmpeg press enter and it goes to town YouTube DL is one of those utilities that is hyper powerful so to really get a full scope of what it's capable of you should consult the help documentation but the formula that I most frequently use to download the highest resolution video available is the following first of all we're going to need to copy the URL of the video we'd like to download to our clipboard so go to Safari find a video you'd like copy and then type the following command youtube – DL – F best video so we're requesting the highest resolution available + best audio and again you can define these manually you can define the exact resolution that you want to download it to if you'd like but these are the defaults and then you type the URL youtube-dl goes out fetches the video and then shows you the download progress on the five hundred eighty three point three three megabyte file now it's saving in a dot WebM dot WebM is not natively supported inside of Mac OS 10 so it's actually going to download the file first and then it converts it using ffmpeg to an mp4 by default but you can leave it as a WebM if you'd like or to change it to any file format you can desire using one of YouTube's deals very very powerful utilities just be sure to read through this help documentation because it can do a lot and it's slicker than a GUI based YouTube downloader okay you know what they say the best for first and last I don't admittedly use homebrew all that often I do use cask almost on the daily and this is the other application that I use all the time it's called image magic you can install it by typing brew install and then image magic image magic is really powerful basically you provide an input file a photo of any resolution size shape what-have-you you can define some effects that you'd like to apply if desired and then you can choose an export resolution a different file formats different sizes doesn't matter image magic will handle everything let me show you some of the commands that I use with frequency so you do need to manually define your input and output files I could do that by just dragging this field dot jpg file directly into the finder that shows the path but I also need to provide an output path which I have yet to do by default it saves into the route of your home folder but what I would recommend is just defining the folder manually before you start working with the the utility so I type cd' desktop for example to set my main directory as the desktop so any file name that I type is going to be assumed that it's on this folder and when I choose my output file I can just type the name of the file and it will assume the same path to the desktop so let's show you an example of something that I do actually pretty frequently let's do convert we need to provide our input file now so let's do the field dot jpg photo that field dot jpg ok and then we need to I don't know let's say let's add a border we can type border we can then type what resolution or what size we want our border to be let's do it let's do a big one let's do 30 pixels by 30 pixels and then we need to define the border color let's make that white and then we need to output our file so we'll call this bordered dot let's do PNG ok so we're gonna change the file format if I press Enter there you go I have a new folder a new file called border dot PNG not only did it change the file format from jpg to PNG but surely enough it added a 25 or was it 30 a 30 pixel border around our image pretty cool ok so what else can I do let's try a different command something I would try frequently so let's do convert let's do this same field dot jpg folder or file and let's say it's too big that did take a while it's clearly a large file so let's see what resolution are we working with here 3840 by 2160 if we zoom up on screen you can see that it is quite massive yeah that's definitely beyond 1080p so let's go back to our terminal window let's change the resolution of this file so we are going to type resize and then you can type the length resolution that you like so we could do like 1920 if we wanted to do 1920 by 1080 you can do any arbitrary number you want and it will resize will maintain the aspect ratio and sighs so I could do like 1654 if I wanted to and it will resize it properly maintaining at sixteen by nine format now if you wanted to find the other the other lengths so instead of doing 1920 instead of doing the the long length if we wanted to do the short length of the photo we could do X 1080 and that will still provide us a 1920 by 1080 format or you can define the exact resolution you want to export to if you know and it will conform regardless so let's just do 1920 okay so we're going to resize it to that and then we're going to change it back to let's change it to a tiff file for example so we're gonna call it export dot T iff we press enter and surely enough it pops up there it is ready for viewing in a much smaller much more digestible resolution to give you an example of how truly powerful image magic is let me show you a power user demonstration so we're gonna say for files that end in dot jpg so any file on the desktop ending in dot jpg so that's gonna be these two files obviously let's well let's do convert them keeping their original file name attacked and convert sorry well let's change the resolution first so we are going to say resize and rather than manually defining a resolution I could do that if I wanted but these are different size files so let's resize them to fifty percent of their original size and then we are going to change the name of the export file to not just the same name but we're going to change it to small – and then use the original file name so now what's going to happen if we press Enter is it is going to export two photos it has the same names they had before but adds small as a prefix because that's one of the things we requested and if we note the resolution let's look at this one so command I we can see that this one is 500 by 478 pixels if we go to this one will see that it is 250 by 239 pixels it's exactly the same image just a little bit smaller image magic is crazy powerful well folks if you enjoyed this video please give it a like if you didn't well that other button seems to work okay to get subscribed for more awesome tech videos like these but most importantly and as always stay snazzy