Thursday 28 April 2016

Write to NTFS drives in Mac






Mac OS X can read from NTFS drives, but it can’t write to them unless you use one of the below tricks.

Three Options

There are several options for this, and you’ll need to choose one:
  • Paid Third-Party Drivers: There are third-party NTFS drivers for Mac that you can install, and they’ll work quite well. These are paid solutions, but they’re easy to install and reportedly offer better performance than the free solutions below.
  • Free Third-Party Drivers: There are also free and open-source NTFS drivers you can install on a Mac to enable write support. Unfortunately, these take a bit of extra work to install, especially on OS X 10.11 El Capitan with the new System Integrity Protection feature. They may also not work as well as paid solutions, and may be slower.
  • Apple’s Experimental NTFS-Write Support: Mac OS X includes experimental support for writing to NTFS drives. However, it’s off by default and requires some messing around in the terminal to enable it. It isn’t guaranteed to work properly and could potentially cause problems with your NTFS.

Free Third-Party Drivers – It’s Free, But Takes Some Work

This method is free, but it requires a good bit of work. To do this, you’ll have to disable System Integrity Protection and then re-enable if after you’re done.

First, download osxfuse and install it.

Second, download and install homebrew if you haven’t already installed it on your Mac. Homebrew is a “package manager” for Mac OS X.

You’ll need the command-line tools installed to continue. If you haven’t installed them yet, you can open a Terminal window from Applications > Utilities and run the following command to do so:

xcode-select –install

Once you have, run the following command in a Terminal window to install ntfs-3g from Homebrew:
brew install homebrew/fuse/ntfs-3g


Next, you’ll need to disable System Integrity Protection. Reboot your Mac and hold Command+R while it’s booting. It’ll boot into a special recovery mode environment.

Launch a terminal from the Utilities menu in recovery mode and run the following command:
csrutil disable
Once you have, reboot your Mac normally.

From the Mac desktop, open a Terminal window again and run the following commands to make ntfs-3g function:
sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.original
sudo ln -s /usr/local/sbin/mount_ntfs /sbin/mount_ntfs

Lastly, re-enable System Integrity Protection. Reboot your Mac and hold Command+R while it’s booting to enter recovery mode. Launch a terminal in recovery mode and run the following command:
csrutil enable

Once you have, reboot your Mac. NTFS-write support should be functioning now.


If you want to undo the changes

To undo your changes and uninstall everything, you’ll need to first disable System Integrity Protection. After you do, run the following commands:

sudo rm /sbin/mount_ntfs
sudo mv /sbin/mount_ntfs.original /sbin/mount_ntfs
brew uninstall ntfs-3g
You can then uninstall FUSE for OS X from its panel in the System Preferences window and re-enable System Integrity Protection



Most Mac users will be better off formatting external drives with exFAT, ensuring they work well on both Windows and Mac OS X without any extra work. if you must write to an NTFS drive, one of the paid, third-party drivers will be the best-performing, least-effort option.

Thursday 14 April 2016

Automate Repetitive Tasks on Mac


For all the old jokes about one-button mice and simplicity, Macs have some power-user features Windows just doesn’t offer. Automator is one of them, offering a simple way to automate repetitive tasks without any third-party software.

Automator is a powerful tool, and there’s a lot you can do with it. You can use the graphical interface to create automation “recipes” with drag-and-drop, or write AppleScript by hand. A quick web search will lead you to many different examples of things you can do with it.


Launching Automator and Creating a Document

Automator is installed on your Mac by default, so you can launch it by pressing Command+Space to open Spotlight search, typing Automator, and pressing Enter. You could also find it under Other > Automator in Launchpad or Applications > Automator in the Finder.

You’ll see a variety of different document types you can start with. All of these are basically different types of workflows; they’re just triggered in different ways:

  • Workflow: A workflow is a series of actions that runs inside of Automator.
  • Application: An application is the same as a workflow, but it can be run as an application from outside Automator. For example, you could drag-and-drop files onto the application’s icon to run the workflow on it from outside automator.
  • Service: This allows you to create a “service,” which will be accessible from the Services menu in other applications.
  • Print Plugin: A print plugin appears in the system’s print dialog.
  • Folder Action: This is a workflow that you tie to a specific folder on your Mac. When you add files to that folder, your Mac will automatically run the workflow on them.
  • Calendar Alarm: This runs when a specific event occurs in your calendar.
  • Image Capture Plugin: This appears as an option in the Image Capture utility, used when transferring photos to your Mac.
  • Dictation Command: This runs when triggered by a voice command, known as a dictation command, on your Mac.



Creating a Simple Service

As an example, we’ll create a service you can use in any application. First, we’d select Service in the dialog and click Choose. At the top of the window, we can then choose what we want the service to work with. By default, it’s set to “Service receives selected text in any application.” 
This means you can select text and then click the application’s menu, point to Services, and choose your service in any application. (You may also be able to right-click or Control-click the text, depending on the application.)

You could modify this, though. For example, you could choose “Service receives files or folders in Finder” and the service would only appear when you select files or folders in the Finder app.


You can then select actions from the left pane. Drag and drop them to the right side and they’ll be run in the order you choose. For example, we can drag and drop the Text>Speak Text action onto the right pane and choose a voice.


Click the File menu, click Save, and enter a name for your service. It’ll then appear as an option on your system. For example, after saving the above service, we can now select text in any application, click the Services menu, and select our service to have the computer read that text aloud for us.




More Tricks

We created a service in the above example, but the process is similar for any type of workflow you might want to create. You can add multiple actions from the left pane and arrange them in the order you like via drag-and-drop to perform many operations on the items in order. For example, you could create a Folder action that takes images you add to a certain folder, creates a backup copy, and then shrinks them down for you.


You can also click the Record button to record a series of mouse clicks and typing events on your computer, allowing you to automatically perform them later. This is basically like recording a macro, and it allows you to have your Mac copy your actions automatically. After recording, the sequence of events will appear as a “Watch Me Do” action you can place anywhere you like in a workflow.


To do even more, there’s the Run AppleScript action that you can use to automatically run code written in AppleScript. If you search the web, you’ll find a variety of useful actions written in AppleScript that you can copy-and-paste into the Run AppleScript action. This allows you to do more advanced things that don’t appear as easy drag-and-drop actions in Automator.


We’re obviously just scratching the surface here, and that’s the idea. Entire books could be been written on this subject. With the basics figured out, you can poke around Automator and figure out how to make it do what you want it to do. You can also feel empowered to search the web for useful Automator workflows and snippets of AppleScript that can quickly perform those repetitive tasks for you, understanding how Automator works and how to use them.

Hide Files and View Hidden Files on Mac OS X




Macs offer a way to hide files and folders, just like other operating systems. But Mac OS X hides these options and doesn’t make it as easy as it is on Windows and Linux.

To hide a file or folder, you’ll need to set the “hidden” attribute for it. The Finder and other Mac apps will then ignore and not display this file or folder by default.


Hide a File or Folder on a Mac

Rather than hiding an individual file — although you can do that — you may want to create a hidden folder. We’ll do that for this example, although this trick will also work to hide individual files.

First, open a terminal window — press Command+Space, type Terminal, and press Enter. In the terminal, type the following command, including a space at the end of it:

chflags hidden


Drag-and-drop a folder or file from the Finder into the terminal window.


The path of the file or folder will appear in the terminal. Press Enter to run the command and the file or folder will vanish. It’s still there — it’s just hidden, so the Finder won’t show it by default.



Access a Hidden File or Folder

Want to quickly access a hidden folder from the Finder? The easiest way is to click the Go menu in the Finder and select Go to Folder.



Plug the path of the folder into the dialog box and click Go or press Enter. The ~ stands for your user folder, so if you had a folder named SecretStuff on your desktop, you’d enter ~/Desktop/SecretStuff. If it was in Documents, you’d enter ~/Documents/SecretStuff.

Although the folder is hidden and won’t appear normally in the Finder or save dialogs, you can quickly access it this way. Any files you store in this folder are effectively hidden, too — no one can accidentally click their way to the folder, but they’ll appear in the Finder if you go there directly.


View Hidden Files and Folders in the Open/Dialog

While the Finder doesn’t offer a graphical option to let you find those hidden files and folders, the Open and Save dialog on Mac OS X does.

To view hidden files and folders in the Open/Save dialog, just press Command+Shift+Period (that’s the . key).

You’ll have to click a different folder in the Open/Save dialog after pressing this shortcut. So, if the hidden folder is on the desktop, it won’t appear immediately when you press Command+Shift+Period. You have to press this keyboard shortcut, click over to another folder, and then click the Desktop folder again. Hidden folders and files will appear so you can easily access them from here.



View Hidden Files in the Finder

The Finder does offer an option to view hidden files. However, this isn’t a graphical option — you have to enable it with a terminal command and restart the Finder for your changes to take effect.

To view hidden files in the Finder, open a Terminal window and run the following commands in it, pressing Enter after each one:

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

If you’d like to view and hide hidden files and folders with a key press, you could create an Automator script that automatically runs these commands when you press a certain key or click a menu option.


Unhide a File or Folder

Want to unhide a file or folder? Run the same command you ran before, but change “hidden” to “nohidden”. In other words, type the following command into the terminal, typing a space after it:

chflags nohidden

If you remember the exact path of the folder or file, you can type it into the terminal. If you don’t, you can use the above trick to display hidden files and folder in the Finder and drag and drop that hidden file or folder into the Terminal, as you did earlier.




(You can also press the up arrow key at the terminal to cycle through previous commands, locating the command that made the file or folder hidden. Use the left arrow key to go to the “hidden” part of the command and change it to “nohidden”, and then press Enter.)

Type Enter afterward and the file or folder will become unhidden, so you can access it normally.




Hide, Show, and Encrypt Files and Folders the Secure Way



If you really want to hide files or folders completely, encrypt them, and keep them behind a password, you can do it really easily with Hider 2, a great, simple application that lives in your menu bar. Just drag any file straight to the menu bar to hide it. If you want to unhide the file so you can view it or make changes, you can easily flip the radio button over to show or hide it again.

It’s not a free application, but you can download a free trial and test it out before you buy.

You can also hide files or folders by renaming them to begin with a “.”, or period, character. However, Mac OS X won’t let you rename files or folders to this from the Finder window, so you’ll have to do so from the Terminal. You can also run various Terminal commands that will display these files.

This can be useful if you share a computer with someone, but someone who goes looking for these hidden files and folders can easily find them. It’s not a foolproof way to protect your files and folders from others, but encryption is.