Code Monkey home page Code Monkey logo

osx-ramdisk's Introduction

OS X RAM Disk

Build Status

Need really fast Java IDE or browser? Then keep reading.

This app will create a RAM disk in OS-X with specified size to store the apps cache in RAM, which is known as SSD optimization - reducing disk IO or making browsing the web and programming using IntelliJ more enjoyable.

Supported apps (you can add yours):

The IntelliJ Idea (or JetBrains IDEs) are really fast after this. Be aware that for the large code base you will need to have larger RAM Disk. I don't have exact numbers, sorry, it can vary because of many factors. Mine machine have 16GB - it works very good for small code bases.

If you observing performance degradation - revise how much memory you are using and may be adding more can help. By default script will create RAM disk of 1/4 size of your RAM. If you need to change the size - edit startupRAMDiskandCacheMover.sh header section. The RAM disk works with hibernate option - you don't need to worry about this part.

Have something to discuss? Join the chat at https://gitter.im/zafarella/OSX-RAMDisk

CII Best Practices

If you have any issues (compatibility etc) - I am glad to have them reported in the issues tab.

Compatibility

Works on

  • MAC OS X 10.10.2 Yosemite
  • MAC OS X 10.11 EI Capitan
  • MAC OS X 10.12 Sierra

Note that you have to re-run the script in order to get the ram disk back after machine restart. Currently it does not place it on startup - I'm working on it.

Give it a try before installing

$ curl -o startupRAMDiskandCacheMover.sh https://raw.githubusercontent.com/zafarella/OSX-RAMDisk/master/Contents/MacOS/startupRAMDiskandCacheMover.sh &&
chmod +x startupRAMDiskandCacheMover.sh &&
./startupRAMDiskandCacheMover.sh

or

git clone [email protected]:zafarella/OSX-RAMDisk.git &&
OSX-RAMDisk/Contents/MacOS/startupRAMDiskandCacheMover.sh

Jetbrains IDE notes (IntelliJ)

In order to speed up the compilation and responsiveness of the IDE you can change "Project compiler output" and point it to ram disk:

echo /Volumes/ramdisk/${USER}/compileroutput

and in your project/module settings (Command+down) point to this directory. You can also set this setting by default for your projects at the main menu, choose File | Other Settings | Default Settings

In addition to above you can tune jvm with following flags vim /Applications/IntelliJ\ IDEA\ 15.app/Contents/bin/idea.vmoptions

Installation

Do not use it now - the startup script does not work yet - work in progress

git clone [email protected]:zafarella/OSX-RAMDisk.git
cd OSX-RAMDisk
make install

Manual Installation

cp OSXRamDisk.plist ~/Library/LaunchAgents
cp startupRAMDiskandCacheMover.sh /usr/local/bin
# note - it will close Chrome, safari idea
/usr/local/bin/startupRAMDiskandCacheMover.sh

Uninstall

Run make uninstall or manually do following

Close the chrome, idea or any other application you configured to use ram disk.

   rm /usr/local/bin/startupRAMDiskandCacheMover.sh
   launchctl unload -w ~/Library/LaunchAgents/OSXRamDisk.plist
   rm ~/Library/LaunchAgents/OSXRamDisk.plist

Alternatives

If you are Linux user use


Was made with โ™ฅ in NYC

osx-ramdisk's People

Contributors

awsp avatar bitdeli-chef avatar ewg777 avatar jdarowski avatar litealex avatar telefunken avatar zafarella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osx-ramdisk's Issues

Where is `createRAMDiskandMoveCaches.sh`?

I was trying to do manual installation as the auto installation failed with the following code. (with sudo)

[ ! -d /usr/local/bin/ ] && mkdir -p /usr/local/bin
make: *** [install] Error 1

I went manual installation and I was searching the whole repo for this file createRAMDiskandMoveCaches.sh but I don't see it nowhere.

It looks like the volumes is not creating the ramdisk when I perform a cold startup of my computer.
In the plist it is calling createRAMDiskandMoveCaches.sh, so where could I get that file?

FYI:
I am using Mac OS X 10.10.4 with 12GB ram

On macOS high Serria hdid error

In my macOS High Seria hdid return error.

I modify the startupRAMDidskAndCacheMover.sh like this patch :

--- startupRAMDiskandCacheMover.sh	2017-12-12 09:31:48.000000000 +0100
+++ /usr/local/bin/startupRAMDiskandCacheMover.sh	2017-12-12 09:50:26.000000000 +0100
@@ -16,21 +16,31 @@
 # IF YOUR RAM IS BROKEN - DO NOT USE IT.
 #
 
-# The RAM amount you want to allocate for RAM disk. One of
-# 1024 2048 3072 4096 5120 6144 7168 8192
-# By default will use 1/4 of your RAM
-
-ramfs_size_mb=$(sysctl hw.memsize | awk '{print $2;}')
-ramfs_size_mb=$(${ramfs_size_mb} / 1024 / 1024 / 4)
-
+# 
+ramfs_size_mb=500
 mount_point=/Users/${USER}/ramdisk
-ramfs_size_sectors=$("${ramfs_size_mb}"*1024*1024/512)
-ramdisk_device=$(hdid -nomount ram://"${ramfs_size_sectors}")
-USERRAMDISK="${mount_point}"
-
+USERRAMDISK=/Users/${USER}/ramdisk
 MSG_MOVE_CACHE=". Do you want me to move its cache? Note: It will close the app."
 MSG_PROMPT_FOUND="I found "
 
+umount -f /Users/${USER}/ramdisk 
+
+mkramdisk() {
+  echo "Creation ram disk"
+  ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
+  echo "RAMDISK sector $ramfs_size_sectors"
+  ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
+  echo "RAMDISK dev : $ramdisk_dev"
+  newfs_hfs -v 'ram disk' ${ramdisk_dev}
+  mkdir -p ${mount_point}
+  mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
+
+  echo "remove with:"
+  echo "umount ${mount_point}"
+  echo "diskutil eject ${ramdisk_dev}"
+}
+
+
 #
 # Checks for the user response.
 #
@@ -66,10 +76,7 @@
 mk_ram_disk()
 {
     # unmount if exists and mounts if doesn't
-    umount -f "${mount_point}"
-    newfs_hfs -v 'ramdisk' "${ramdisk_device}"
-    mkdir -p "${mount_point}"
-    mount -o noatime -t hfs "${ramdisk_device}" "${mount_point}"
+    mkramdisk
 
     echo "created RAM disk."
     # Hide RAM disk - we don't really need it to be annoiyng in finder.
@@ -150,11 +157,13 @@
     if [ -d "/Users/${USER}/Library/Caches/Google/Chrome" ]; then
         if user_response "${MSG_PROMPT_FOUND}" 'Chrome'"${MSG_MOVE_CACHE}" ; then
             close_app "Google Chrome"
-            /bin/mkdir -p /tmp/Google/Chrome
-            /bin/mv ~/Library/Caches/Google/Chrome/* /tmp/Google/Chrome/
-            /bin/mkdir -pv "${USERRAMDISK}"/Google/Chrome/Default
-            /bin/mv /tmp/Google/Chrome/ "${USERRAMDISK}"/Google/Chrome
-            /bin/ln -v -s -f "${USERRAMDISK}"/Google/Chrome/Default ~/Library/Caches/Google/Chrome/Default
+            rm -r -f /tmp/Google/*
+
+            /bin/mkdir -p /tmp/Google/
+            /bin/mv ~/Library/Caches/Google /tmp/Google/
+            /bin/mkdir -pv "${USERRAMDISK}"/Google/
+            /bin/mv /tmp/Google/ "${USERRAMDISK}"/Google/
+            /bin/ln -v -s -f "${USERRAMDISK}"/Google/ ~/Library/Caches/Google
             /bin/rm -rf /tmp/Google/Chrome
             # and let's create a flag for next run that we moved the cache.
             echo "";

Speed test :

$ gdd bs=1M count=256 if=/dev/zero of=test
256+0 records in
256+0 records out
268435456 bytes (268 MB, 256 MiB) copied, 0,169334 s, 1,6 GB/s

It works fine !

idea cache is not read by application

this line after running
/Applications/IntelliJ IDEA.app/Contents/bin/idea.properties.back:idea.system.path=/Users/zkhaydarov/ramdisk/Idea

does not forces idea (16) to use ramdisk for cache

split applications by files

Like:

  • chrome -> chrome.sh or something similar
  • safari
  • iTunes
  • etc

it should contain all needed for the app cache to be moved to RAM.

Main file should call them depend on the settings/user input.

No permisson on MacOS

Hi,

This looks great, however, when using macos it has no permission to create the permission?

Regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.