Skip to content

Instantly share code, notes, and snippets.

@ktwrd
Created February 28, 2021 09:25
Show Gist options
  • Save ktwrd/1de729dbc17f147fa22a8524b0133ab5 to your computer and use it in GitHub Desktop.
Save ktwrd/1de729dbc17f147fa22a8524b0133ab5 to your computer and use it in GitHub Desktop.
Mount NTFS with NTFS-3G
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMApplicationBuild</key>
<string>444.7</string>
<key>AMApplicationVersion</key>
<string>2.8</string>
<key>AMDocumentVersion</key>
<string>2</string>
<key>actions</key>
<array>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<true/>
<key>Types</key>
<array>
<string>com.apple.applescript.object</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>1.0</string>
<key>AMApplication</key>
<array>
<string>Automator</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>source</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.applescript.object</string>
</array>
</dict>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Run JavaScript.action</string>
<key>ActionName</key>
<string>Run JavaScript</string>
<key>ActionParameters</key>
<dict>
<key>source</key>
<string>function run(input, parameters) {
// Your script goes here
const app = Application.currentApplication();
app.includeStandardAdditions = true;
var volumes = app.doShellScript('ls /Volumes/').split("\r");
return volumes;
}</string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.Automator.RunJavaScript</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<true/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>RunJavaScriptAction</string>
<key>InputUUID</key>
<string>5E843A39-D239-4AB7-8A9F-20EED05C2B5B</string>
<key>Keywords</key>
<array>
<string>Run</string>
<string>JavaScript</string>
</array>
<key>OutputUUID</key>
<string>903A7723-D8C6-4053-9393-19D49B6EE842</string>
<key>UUID</key>
<string>BAC1347D-872D-4CC0-9BB7-8009EF0ACCC3</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<string>function run(input, parameters) {
// Your script goes here
return input;
}</string>
<key>name</key>
<string>source</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
</dict>
<key>conversionLabel</key>
<integer>0</integer>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>450.500000:248.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Run JavaScript.action/Contents/Resources/Base.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<true/>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>2.0.3</string>
<key>AMApplication</key>
<array>
<string>Automator</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>COMMAND_STRING</key>
<dict/>
<key>CheckedForUserDefaultShell</key>
<dict/>
<key>inputMethod</key>
<dict/>
<key>shell</key>
<dict/>
<key>source</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Run Shell Script.action</string>
<key>ActionName</key>
<string>Run Shell Script</string>
<key>ActionParameters</key>
<dict>
<key>COMMAND_STRING</key>
<string>for f in "$@"
do
type=$(diskutil info "/Volumes/$f" | grep 'Type (Bundle):' | head -n1 | cut -d " " -f17)
if [ $type = "ntfs" ]
then
echo $f
fi
done</string>
<key>CheckedForUserDefaultShell</key>
<true/>
<key>inputMethod</key>
<integer>1</integer>
<key>shell</key>
<string>/bin/zsh</string>
<key>source</key>
<string></string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.RunShellScript</string>
<key>CFBundleVersion</key>
<string>2.0.3</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<true/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>RunShellScriptAction</string>
<key>InputUUID</key>
<string>F76856C0-6DD2-45E4-920E-3C0550297167</string>
<key>Keywords</key>
<array>
<string>Shell</string>
<string>Script</string>
<string>Command</string>
<string>Run</string>
<string>Unix</string>
</array>
<key>OutputUUID</key>
<string>5B9C5A81-E561-42FB-91E9-15C87A6463CA</string>
<key>UUID</key>
<string>2443D982-9947-452A-B365-97B9573DF953</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<integer>0</integer>
<key>name</key>
<string>inputMethod</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
<key>1</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>source</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>1</string>
</dict>
<key>2</key>
<dict>
<key>default value</key>
<false/>
<key>name</key>
<string>CheckedForUserDefaultShell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>2</string>
</dict>
<key>3</key>
<dict>
<key>default value</key>
<string></string>
<key>name</key>
<string>COMMAND_STRING</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>3</string>
</dict>
<key>4</key>
<dict>
<key>default value</key>
<string>/bin/sh</string>
<key>name</key>
<string>shell</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>4</string>
</dict>
</dict>
<key>conversionLabel</key>
<integer>0</integer>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>450.500000:611.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<false/>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
<string>com.apple.applescript.text-object</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>1.0.2</string>
<key>AMApplication</key>
<array>
<string>Automator</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>prompt</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.cocoa.string</string>
</array>
</dict>
<key>AMRequiredResources</key>
<array/>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Choose from List.action</string>
<key>ActionName</key>
<string>Choose from List</string>
<key>ActionParameters</key>
<dict>
<key>prompt</key>
<string>Select an NTFS Volume</string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.Automator.ChooseFromList</string>
<key>CFBundleVersion</key>
<string>1.0.2</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<false/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>ChooseFromList</string>
<key>InputUUID</key>
<string>5B61D601-2813-4345-9E54-4FCFF4B2F281</string>
<key>Keywords</key>
<array/>
<key>OutputUUID</key>
<string>CAB479D7-F261-46E3-AD05-F02398FD7EDF</string>
<key>UUID</key>
<string>64156C64-DA38-4BEE-BB3E-06D66E72CFFF</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<string>Please make your selection:</string>
<key>name</key>
<string>prompt</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
</dict>
<key>conversionLabel</key>
<integer>0</integer>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>450.500000:716.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Choose from List.action/Contents/Resources/Base.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
<dict>
<key>action</key>
<dict>
<key>AMAccepts</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Optional</key>
<true/>
<key>Types</key>
<array>
<string>com.apple.applescript.object</string>
</array>
</dict>
<key>AMActionVersion</key>
<string>1.0</string>
<key>AMApplication</key>
<array>
<string>Automator</string>
</array>
<key>AMParameterProperties</key>
<dict>
<key>source</key>
<dict/>
</dict>
<key>AMProvides</key>
<dict>
<key>Container</key>
<string>List</string>
<key>Types</key>
<array>
<string>com.apple.applescript.object</string>
</array>
</dict>
<key>ActionBundlePath</key>
<string>/System/Library/Automator/Run JavaScript.action</string>
<key>ActionName</key>
<string>Run JavaScript</string>
<key>ActionParameters</key>
<dict>
<key>source</key>
<string>function run(i, p) {
// Your script goes here
i.forEach((input)=&gt;{
const app = Application.currentApplication();
app.includeStandardAdditions = true;
var device = app.doShellScript(`df -h | grep "/Volumes/${input}" | head -n1 | cut -d " " -f1 | cut -d "/" -f3`);
console.log(`[FetchDevice] ${input} -&gt; /dev/${device}`);
console.log(`[Remount] Unmounting Partition /dev/${device}`);
app.doShellScript(`diskutil unmount /dev/${device}`, {administratorPrivileges:true});
console.log(`[Remount] Umounted Volume`);
console.log(`[Remount] Mounting Volume with ntfs-3g`);
app.doShellScript(`/usr/local/bin/ntfs-3g /dev/${device} /Volumes/${device} -olocal -oallow_other`, {administratorPrivileges:true});
})
return i;
}</string>
</dict>
<key>BundleIdentifier</key>
<string>com.apple.Automator.RunJavaScript</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CanShowSelectedItemsWhenRun</key>
<false/>
<key>CanShowWhenRun</key>
<true/>
<key>Category</key>
<array>
<string>AMCategoryUtilities</string>
</array>
<key>Class Name</key>
<string>RunJavaScriptAction</string>
<key>InputUUID</key>
<string>A64C3AD6-2FC8-4148-9D3F-228DDF3FA550</string>
<key>Keywords</key>
<array>
<string>Run</string>
<string>JavaScript</string>
</array>
<key>OutputUUID</key>
<string>B9E10368-022A-4232-9332-96EEC2D40241</string>
<key>UUID</key>
<string>45CFCE11-2651-4AA3-BE1B-94B9196AD624</string>
<key>UnlocalizedApplications</key>
<array>
<string>Automator</string>
</array>
<key>arguments</key>
<dict>
<key>0</key>
<dict>
<key>default value</key>
<string>function run(input, parameters) {
// Your script goes here
return input;
}</string>
<key>name</key>
<string>source</string>
<key>required</key>
<string>0</string>
<key>type</key>
<string>0</string>
<key>uuid</key>
<string>0</string>
</dict>
</dict>
<key>conversionLabel</key>
<integer>0</integer>
<key>isViewVisible</key>
<true/>
<key>location</key>
<string>450.500000:1142.000000</string>
<key>nibPath</key>
<string>/System/Library/Automator/Run JavaScript.action/Contents/Resources/Base.lproj/main.nib</string>
</dict>
<key>isViewVisible</key>
<true/>
</dict>
</array>
<key>connectors</key>
<dict>
<key>14547A9D-952D-4DE0-945C-6AEA88328D7D</key>
<dict>
<key>from</key>
<string>BAC1347D-872D-4CC0-9BB7-8009EF0ACCC3 - BAC1347D-872D-4CC0-9BB7-8009EF0ACCC3</string>
<key>to</key>
<string>2443D982-9947-452A-B365-97B9573DF953 - 2443D982-9947-452A-B365-97B9573DF953</string>
</dict>
<key>78EC04C9-7307-45C2-941D-1A098E574292</key>
<dict>
<key>from</key>
<string>64156C64-DA38-4BEE-BB3E-06D66E72CFFF - 64156C64-DA38-4BEE-BB3E-06D66E72CFFF</string>
<key>to</key>
<string>45CFCE11-2651-4AA3-BE1B-94B9196AD624 - 45CFCE11-2651-4AA3-BE1B-94B9196AD624</string>
</dict>
<key>F5E95CC1-3191-43C0-B015-8D8F9CE8DD24</key>
<dict>
<key>from</key>
<string>2443D982-9947-452A-B365-97B9573DF953 - 2443D982-9947-452A-B365-97B9573DF953</string>
<key>to</key>
<string>64156C64-DA38-4BEE-BB3E-06D66E72CFFF - 64156C64-DA38-4BEE-BB3E-06D66E72CFFF</string>
</dict>
</dict>
<key>variables</key>
<array>
<dict>
<key>UUID</key>
<string>25D50DAD-0E6E-4033-9CA3-8C635BBEB9BA</string>
<key>identifier</key>
<string>com.apple.Automator.Variable.Text</string>
<key>name</key>
<string>AvailableVolumes</string>
<key>value</key>
<string>Games</string>
</dict>
<dict>
<key>UUID</key>
<string>6DE764F1-1356-433C-B6E7-BD608E5E6768</string>
<key>identifier</key>
<string>com.apple.Automator.Variable.Storage</string>
<key>name</key>
<string>SelectedVolume</string>
</dict>
<dict>
<key>UUID</key>
<string>E69167FD-7CF6-4CA4-B19D-40EC925B70FC</string>
<key>identifier</key>
<string>com.apple.Automator.Variable.Storage</string>
<key>name</key>
<string>MountedVolumes</string>
</dict>
</array>
<key>workflowMetaData</key>
<dict>
<key>workflowTypeIdentifier</key>
<string>com.apple.Automator.workflow</string>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment