How to prevent a MBP from sleeping when the lid is closed?

Discussion in 'MacBook Pro' started by reddevil0728, Apr 3, 2011.

  1. reddevil0728 macrumors regular

    Joined:
    Jun 19, 2010
    #1
    Tried InsomniaX 1.35. Somehow it doesn't work for the Early 2011 version of the MBP.

    Any other alternatives?
     
  2. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #4
    It's a must to do all the steps if I want to have it activated on startup is it? If I do not want to have it activated on startup, I can simply just go System Preferences and activate it myself?

    Is there a shortcut to the activation?

    I only want to activate it so that it wouldn't sleep when I close the lid.

    In addition, how do I write a script with the command to automatically launch the program on startup?
     
  3. Cantisama macrumors member

    Joined:
    Feb 27, 2011
    #5
    Yes, InsomniaT installs under the "Other" section of System Preferences. You can log in, go to System Preferences, and activate it manually. By default it is not activated at log in, only by running a script at log in can you activate it automatically.

    That's all InsmoniaT does. If it is active then your laptop won't sleep when the lid closes, if it is not active then the laptop does the default behavior (which is currently to sleep on lid close). Even if InsomniaT is active you can still manually sleep using the apple menu or keyboard shortcut (command+option+eject).

    It's step 3 of that post I mentioned. Use TextEdit to create a new file with line "insomniat --disable", save the file as "insomniat_start.command", go to System Preferences->Accounts->(your account)->Login Items->(point to the location of your .command script). Reboot and you're good to go.
     
  4. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #6
    where is a good place to save the file?

    If let's say it automatically runs on login, can I still inactivate it by going to system preferences?
     
  5. Cantisama macrumors member

    Joined:
    Feb 27, 2011
    #7
    I keep mine in a "scripts" folder I made in Documents (although it is the only script there at the moment). It doesn't really matter where you keep it, just place it where you won't accidentally delete it (like don't keep it in Downloads).

    Yes
     
  6. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #8
    When I try to save the thingy this error came up.

    [​IMG]
     
  7. onelazyman macrumors newbie

    Joined:
    Mar 1, 2011
    #9
    Are you sure you have clicked "Make Plain Text" under the Format menu in TextEdit?
     
  8. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #10
    oops. i didn't...

    ok here's another problem

    [​IMG]
     
  9. kayloh20 macrumors regular

    Joined:
    Apr 8, 2010
    Location:
    Chicago, IL
    #11
    Based on the error message, you need to right-click on the file and click Get Info (or select the file and go File > Get Info).

    At the bottom of the Info window, there should be a Sharing and Permissions category. Make sure that you can Read & Write (there should be several entries...pick the one that your account falls under, whether it's everyone or admin or whatnot).

    Anyway, thanks for the find! Even SleepLess doesn't work on the newer MBP (for me at least).
     
  10. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #12
    set all to read&write still same problem

    What program is it supposed to be opened with? Terminal?
     
  11. Cantisama macrumors member

    Joined:
    Feb 27, 2011
    #13
    Read and write isn't important here. You need to set execute permission for the script. Open a terminal to the script file and run "chmod +x insomniat_start.command". Actually you may have to run "sudo chmod +x insomniat_start.command" instead, depends on your access permissions (if it doesn't work without sudo then try with sudo).

    It is supposed to be opened with terminal.
     
  12. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #14
    Don't quite get you but this is what I did. I click on the script, the error appear. After I click on a terminal appear. I key in the sudo.... then they prompt for password (which I assumed is the password which i need to input whenever i need to authorise certain stuff to be done) and somehow it's invisible but i just keyed it in anyway and hit enter. and this is what i see

    [​IMG]
     
  13. Cantisama macrumors member

    Joined:
    Feb 27, 2011
    #15
    That error occurred because the Terminal is not in the same working directory as your script. If your script is located at "/Users/john/Documents/scripts/insomniat_start.command", then open a terminal and run:

    cd /Users/john/Documents/scripts
    chmod +x insomniat_start.command

    Or you can combine that into one command:
    chmod +x /Users/john/Documents/scripts/insomniat_start.command

    Again I don't remember if you need to use sudo or not for chmod, I doubt you do but if it doesn't work then try it with sudo.
     
  14. reddevil0728 thread starter macrumors regular

    Joined:
    Jun 19, 2010
    #16
    Oh it works. But is it possible to prevent this terminal window from popping up by itself whenever the computer starts saying that the process completed?
     
  15. Cantisama, Apr 4, 2011
    Last edited: Apr 4, 2011

    Cantisama macrumors member

    Joined:
    Feb 27, 2011
    #17
    Hmm, not sure. When I log in I see the terminal window appear and disappear in an instant. I don't get a popup or have the terminal stay open saying the process was completed. I think it leaves Terminal loaded in memory but it barely uses any space, I can manually terminate it if I want to (I don't care since I use Terminal a lot).

    -Edit-
    Maybe modify insomniat_start.command to look like this:

    #!/bin/sh
    insomniat --disable
    exit

    I tried a lot of things before getting insomniat to enable at launch, I don't remember if ^ works or not.
     

Share This Page