├── .gitattributes ├── Video.md ├── _config.yml ├── LICENSE ├── README.md ├── index.md ├── macOS-RamDisk.tool └── Main Script.scpt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Video.md: -------------------------------------------------------------------------------- 1 | ### Video macOS-RamDisk V1-Terminal 2 | 3 | 4 | https://user-images.githubusercontent.com/6248794/216827468-4d41c9ab-8583-4c89-a2df-6fb23d74b020.mov 5 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: macOSRamDisk 2 | description: Simple wrapper to create a RamDisk on macOS 3 | github: 4 | repository_url: https://github.com/chris1111/macOSRamDisk 5 | remote_theme: chris1111/cayman-dark 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 chris1111 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [macOSRamDisk](https://chris1111.github.io/macOSRamDisk/) 2 | 3 | - Simple wrapper bash script bundle to create a RamDisk on macOS 4 | - Simple wrapper Applescript bundle to create a RamDisk on macOS 5 | - Credit: [Apple](https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html) 6 | 7 | 8 | ### App macOS-RamDisk V1-Terminal ⬇︎ 9 | Download ➤ [macOS-RamDisk](https://github.com/chris1111/macOSRamDisk/releases/tag/V1-Terminal) App macOS-RamDisk V1-Terminal `For macOS Big Sur 11 to macOS Sonoma 14` 10 | 11 | 12 | Download ➤ [macOS-RamDisk](https://github.com/chris1111/macOSRamDisk/releases/tag/V1-Terminal-Old) App macOS-RamDisk V1-Terminal-Old `For macOS Yosemite 10.10 to macOS Catalina 10.15` 13 | 14 | ### Small Video macOS-RamDisk V1-Terminal ⬇︎ 15 | [![Modular Image Creation](https://user-images.githubusercontent.com/6248794/180882015-aa6209bd-a10d-4a1e-85cf-d9729b8e0efc.png)](https://github.com/chris1111/macOSRamDisk/blob/main/Video.md) 16 | 17 | 18 | #### Image macOSRamDisk AppleScript ⬇︎ 19 | 20 | ![04155949 2](https://user-images.githubusercontent.com/6248794/216794016-8fcd5c8f-8458-42d8-81bf-829335ed29b8.png) 21 | Download ➤ [macOSRamDisk AppleScript](https://github.com/chris1111/macOSRamDisk/releases/tag/V1) 22 | 23 | 24 | #### If you want to use the terminal see here ➤ [macOS-RamDisk](https://gist.github.com/chris1111/df27e63e4e46bde9ed5841cb232d377e) `For macOS Big Sur 11 to macOS Sonoma 14` 25 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 | AppleScript|Bash Script 6 | :----|:---- 7 | Simple wrapper Applescript bundle to create a RamDisk on macOS|Simple wrapper bash script bundle to create a RamDisk on macOS 8 | 9 | 10 | ------------------------------------------------------------------------------ 11 | 12 | # macOSRamDisk 13 | - Simple wrapper bash script bundle to create a RamDisk on macOS 14 | - Simple wrapper Applescript bundle to create a RamDisk on macOS 15 | - Credit: [Apple](https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html) 16 | 17 | 18 | ### App macOS-RamDisk V1-Terminal ⬇︎ 19 | #### For macOS Big Sur 11 to macOS Sonoma 14 ➥ Download ➤ [macOS-RamDisk](https://github.com/chris1111/macOSRamDisk/releases/tag/V1-Terminal) 20 | App macOS-RamDisk V1-Terminal 21 | #### For macOS Yosemite 10.10 to macOS Catalina 10.15 ➥ Download ➤ [macOS-RamDisk](https://github.com/chris1111/macOSRamDisk/releases/tag/V1-Terminal-Old) 22 | App macOS-RamDisk V1-Terminal-Old 23 | 24 | 25 | ### Small Video macOS-RamDisk V1-Terminal ⬇︎ 26 | [![Modular Image Creation](https://user-images.githubusercontent.com/6248794/180882015-aa6209bd-a10d-4a1e-85cf-d9729b8e0efc.png)](https://github.com/chris1111/macOSRamDisk/blob/main/Video.md) 27 | 28 | 29 | #### Image macOSRamDisk AppleScript ⬇︎ 30 | ![04155949 2](https://user-images.githubusercontent.com/6248794/216794016-8fcd5c8f-8458-42d8-81bf-829335ed29b8.png) 31 | Download ➤ [macOSRamDisk AppleScript](https://github.com/chris1111/macOSRamDisk/releases/tag/V1) 32 | 33 | 34 | ##### If you want to use the terminal see here ➤ [macOS-RamDisk](https://gist.github.com/chris1111/df27e63e4e46bde9ed5841cb232d377e) `For macOS Big Sur 11 to macOS Sonoma 14` 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /macOS-RamDisk.tool: -------------------------------------------------------------------------------- 1 | # macOS-RamDisk By chris1111 2 | # Copyright (c) 2023, chris1111. All Right Reserved. 3 | PARENTDIR=$(dirname "$0") 4 | cd "$PARENTDIR" 5 | printf '\e[8;35;80t' 6 | BOLD="\033[1m" 7 | RED="\033[1;31m" 8 | GREEN="\033[1;32m" 9 | Purple='\033[0;35m' 10 | Blue='\033[0;34m' 11 | Cyan='\033[0;36m' 12 | Yellow='\033[0;33m' 13 | OFF="\033[m" 14 | 15 | nameh=`users` 16 | function echob() { 17 | echo "`tput bold`$1`tput sgr0`" 18 | } 19 | 20 | function head 21 | { 22 | clear 23 | 24 | 25 | echo " *************************************************************** 26 | ${Cyan}macOS-RamDisk${OFF} 27 | ***************************************************************" 28 | 29 | } 30 | function menu 31 | { 32 | echo " 33 | Welcome ${BOLD}${Purple}$nameh${OFF}" 34 | 35 | echo " " 36 | echo " Type ${GREEN}${BOLD}A${OFF} ➣ to START " 37 | echo " " 38 | echo " Type ${RED}${BOLD}X${OFF} ➣ to EXIT " 39 | echo " " 40 | 41 | echo " ***************************************************************" 42 | echo " " 43 | echo " ***************************************************************" 44 | read -n 1 option 45 | } 46 | function RamDisk 47 | { 48 | head 49 | echo " " 50 | echo "macOS-RamDisk" 51 | 52 | echo "———————————————————————————————————————————————————————————————————————————————" 53 | echo Choose the RamDisk size: ${BOLD}Followed by Enter${OFF} 54 | echo " 55 | Value RamDisk size: 56 | Choose the size Number 57 | ${Cyan}⬇︎${OFF} ${GREEN}⬇︎${OFF} 58 | 59 | (${Yellow}256${OFF} Mb) ------- = ${GREEN}524288${OFF} 60 | (${Yellow}512${OFF} Mb) ------- = ${GREEN}1048576${OFF} 61 | (${Yellow}1${OFF} Gb) --------- = ${GREEN}2097152${OFF} 62 | (${Yellow}2${OFF} Gb) --------- = ${GREEN}4194304${OFF} 63 | (${Yellow}3${OFF} Gb) --------- = ${GREEN}6294456${OFF} 64 | (${Yellow}4${OFF} Gb) --------- = ${GREEN}8391608${OFF} 65 | (${Yellow}5${OFF} Gb) --------- = ${GREEN}10488760${OFF} 66 | (${Yellow}6${OFF} Gb) --------- = ${GREEN}12585912${OFF} 67 | (${Yellow}7${OFF} Gb) --------- = ${GREEN}14683064${OFF} 68 | (${Yellow}8${OFF} Gb) --------- = ${GREEN}16384000${OFF}" 69 | echo 70 | read ramdisk_size 71 | echo You have choose $ramdisk_size of ramdisk size 72 | sleep 1 73 | echo " " 74 | echo Choose the ramdisk file system: ${GREEN}HFS+${OFF} / ${GREEN}HFS+J${OFF} / ${GREEN}APFS${OFF}: ${BOLD}Followed by Enter${OFF} 75 | echo 76 | read ramdisk_FS 77 | echo You have choose $ramdisk_FS file system 78 | sleep 2 79 | diskutil partitionDisk $(hdiutil attach -nomount ram://$ramdisk_size) 1 GPTFormat $ramdisk_FS 'RAMDisk' '100%' 80 | 81 | echo "———————————————————————————————————————————————————————————————————————————————" 82 | 83 | 84 | echo "———————————————————————————————————————————————————————————————————————————————" 85 | 86 | Sleep 1 87 | osascript -e 'display notification "'"macOS-RamDisk"'" with title "Build successfull" sound name "Funk"' 88 | 89 | 90 | echo " " 91 | } 92 | function Quit 93 | { 94 | clear 95 | echo " " 96 | echo " 97 | Quit macOS-RamDisk." 98 | 99 | osascript -e 'tell app "terminal" to display dialog "Quit macOS-RamDisk " with icon file "System:Library:CoreServices:loginwindow.app:Contents:Resources:ShutDown.tiff" buttons {"Logout"} default button 1 with title "macOS-RamDisk"' 100 | echo " " 101 | echob "Good By ${Purple}$nameh${OFF}" 102 | echo " " 103 | exit 0 104 | } 105 | while [ 1 ] 106 | do 107 | head 108 | menu 109 | case $option in 110 | 111 | a|A) 112 | echo 113 | RamDisk ;; 114 | x|X) 115 | echo 116 | Quit ;; 117 | 118 | 119 | *) 120 | echo "" 121 | esac 122 | echo 123 | echob "${Cyan}You must type any key to return.${OFF} ${Yellow}You can create another RamDisk." 124 | echo 125 | read -n 1 line 126 | clear 127 | done 128 | 129 | exit 130 | -------------------------------------------------------------------------------- /Main Script.scpt: -------------------------------------------------------------------------------- 1 | # macOSRamDisk By chris1111 2 | # Copyright (c) 2023, chris1111. All Right Reserved. 3 | set macOS to choose from list {"256MB", "512MB", "1GB", "2GB", "3GB", "4GB", "5GB", "6GB", "7GB", "8GB"} with title "macOSRamDisk" with prompt " 4 | Choose the RamDisk size: 5 | Then press RamDisk button 6 | " default items "macOS Ventura" OK button name {"RamDisk"} cancel button name {"Cancel"} 7 | if macOS is false then 8 | display dialog "Quit macOSRamDisk" with icon note buttons {"Exit"} default button {"Exit"} 9 | error number -128 10 | end if 11 | set volumeName to "RAMDisk" 12 | display dialog "Choose the RamDisk file system: 13 | HFS+ 14 | HFS+J 15 | APFS 16 | 17 | Default ➥ (HFS+)" default answer "HFS+" buttons {"Cancel", "OK"} default button 2 18 | set FileSystem to (text returned of the result) 19 | delay 1 20 | if macOS is {"256MB"} then 21 | set sizeInSectors to "524288" 22 | set n to 5 23 | set progress total steps to n 24 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 256MB= (" & sizeInSectors & ")" 25 | set progress additional description to "Create macOS-RamDisk Done" 26 | 27 | repeat with i from 1 to n 28 | delay 0.2 29 | set progress completed steps to i 30 | end repeat 31 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 32 | do shell script the_command 33 | delay 1 34 | end if 35 | 36 | if macOS is {"512MB"} then 37 | set n to 5 38 | set progress total steps to n 39 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 512MB= (" & sizeInSectors & ")" 40 | set progress additional description to "Create macOS-RamDisk Done" 41 | 42 | repeat with i from 1 to n 43 | delay 0.2 44 | set progress completed steps to i 45 | end repeat 46 | set sizeInSectors to "1048576" 47 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 48 | do shell script the_command 49 | delay 1 50 | end if 51 | 52 | if macOS is {"1GB"} then 53 | set n to 5 54 | set progress total steps to n 55 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 1GB= (" & sizeInSectors & ")" 56 | set progress additional description to "Create macOS-RamDisk Done" 57 | 58 | repeat with i from 1 to n 59 | delay 0.2 60 | set progress completed steps to i 61 | end repeat 62 | set sizeInSectors to "2097152" 63 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 64 | do shell script the_command 65 | delay 1 66 | end if 67 | 68 | if macOS is {"2GB"} then 69 | set n to 5 70 | set progress total steps to n 71 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 2GB= (" & sizeInSectors & ")" 72 | set progress additional description to "Create macOS-RamDisk Done" 73 | 74 | repeat with i from 1 to n 75 | delay 0.2 76 | set progress completed steps to i 77 | end repeat 78 | set sizeInSectors to "4194304" 79 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 80 | do shell script the_command 81 | delay 1 82 | end if 83 | 84 | if macOS is {"3GB"} then 85 | set n to 5 86 | set progress total steps to n 87 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 3GB= (" & sizeInSectors & ")" 88 | set progress additional description to "Create macOS-RamDisk Done" 89 | 90 | repeat with i from 1 to n 91 | delay 0.2 92 | set progress completed steps to i 93 | end repeat 94 | set sizeInSectors to "6294456" 95 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 96 | do shell script the_command 97 | delay 1 98 | end if 99 | 100 | if macOS is {"4GB"} then 101 | set n to 5 102 | set progress total steps to n 103 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 4GB= (" & sizeInSectors & ")" 104 | set progress additional description to "Create macOS-RamDisk Done" 105 | 106 | repeat with i from 1 to n 107 | delay 0.2 108 | set progress completed steps to i 109 | end repeat 110 | set sizeInSectors to "8391608" 111 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 112 | do shell script the_command 113 | delay 1 114 | end if 115 | 116 | if macOS is {"5GB"} then 117 | set sizeInSectors to "10488760" 118 | set n to 5 119 | set progress total steps to n 120 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 5GB= (" & sizeInSectors & ")" 121 | set progress additional description to "Create macOS-RamDisk Done" 122 | 123 | repeat with i from 1 to n 124 | delay 0.2 125 | set progress completed steps to i 126 | end repeat 127 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 128 | do shell script the_command 129 | delay 1 130 | end if 131 | 132 | if macOS is {"6GB"} then 133 | set n to 5 134 | set progress total steps to n 135 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 6GB= (" & sizeInSectors & ")" 136 | set progress additional description to "Create macOS-RamDisk Done" 137 | 138 | repeat with i from 1 to n 139 | delay 0.2 140 | set progress completed steps to i 141 | end repeat 142 | set sizeInSectors to "12585912" 143 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 144 | do shell script the_command 145 | delay 1 146 | end if 147 | 148 | if macOS is {"7GB"} then 149 | set n to 5 150 | set progress total steps to n 151 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 7GB= (" & sizeInSectors & ")" 152 | set progress additional description to "Create macOS-RamDisk Done" 153 | 154 | repeat with i from 1 to n 155 | delay 0.2 156 | set progress completed steps to i 157 | end repeat 158 | set sizeInSectors to "14683064" 159 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 160 | do shell script the_command 161 | delay 1 162 | end if 163 | 164 | if macOS is {"8GB"} then 165 | set n to 5 166 | set progress total steps to n 167 | set progress description to "macOS-RamDisk ➤ " & FileSystem & " ➦ 8GB= (" & sizeInSectors & ")" 168 | set progress additional description to "Create macOS-RamDisk Done" 169 | 170 | repeat with i from 1 to n 171 | delay 0.2 172 | set progress completed steps to i 173 | end repeat 174 | set sizeInSectors to "16384000" 175 | set the_command to "diskutil erasevolume " & FileSystem & " '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" 176 | do shell script the_command 177 | delay 1 178 | end if 179 | 180 | 181 | --------------------------------------------------------------------------------