Can't run bash or sudo commands

I have a Mac Pro with OS X 10.8.2 and also an older iMac running OS X 10.6.8. On neither Mac can I run any bash or sudo commands! I always get command not found.
Both Macs have fresh installs of OS X, did I forget to install something? Is X11 needed? or Xcode?
Thanks for any help.

Back up all data.
Select
Shell ▹ New Command
from the Terminal menu bar. Copy and paste the following line into the text box that opens:
mkdir disabled_shell_files; mv .profile .bash* $_
Your old shell initialization and history files will be saved in a directory with the indicated name at the top level of your home directory.

Similar Messages

  • How can I run my program on command line?

    I'm having some trouble trying to run my program on command line.
    I get a message saying "Exception in thread
    "main" java.lang.NoClassDefFoundError: Rectangle
    <a href="http://img145.imageshack.us/my.php?image=untitled2copylh2.jpg" target="_blank"><img src="http://img145.imageshack.us/img145/3002/untitled2copylh2.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>
    import java.util.Scanner;
    public class Rectangle
    public static void main(String[] args)
    int width;
    int height;
    int count = 1;
    Scanner scan = new Scanner (System.in);
    System.out.println("Please enter the width of the rectangle: ");
    width = scan.nextInt();
    System.out.println("Please enter the height of the rectangle: ");
    height = scan.nextInt();
    while (count <= width)
    if(width < 1 || width > 30)
    throw new IllegalArgumentException("The numbers must be in range");
    if(height < 1 || height > 30)
    throw new IllegalArgumentException("The numbers must be in range");
    for (int star = 1; star <= height; star++)
    System.out.print("*");
    System.out.println();
    count++;
    }

    What doesn't work?
    When you type javac Rectangle.java do you get error messages? Does it create the file Rectangle.class? If yes, type java Rectangle and your program should run. If you get an error post it but if you followed earlier advice you should be able to solve the problem yourself.

  • Can't run service perfigo config command on NAC

    I have a new NAC Manager server for a fresh deployment. I logged in using root password with a serial connection to the server.
    I can't seem to be able to run the "service perfigo config" command to perform the initial CAM configuration.
    [root@nacmanager /]# service perfigo start
    perfigo: unrecognized service
    [root@nacmanager /]#
    Any idea what might be the problem?
    Thanks in advance.

    What is happening when you are booting from a CD where NAC ISO is installed on it?
    Usually, during boot, you should receive a installer welcome message:
    Cisco Clean Access 4.8.2 Installer (C) 2011 Cisco Systems, Inc.
                   Welcome to the Cisco Clean Access Installer!
    - To install a Cisco Clean Access device, press the key.
    - To install a Cisco Clean Access device over a serial console, enter serial at the boot prompt and press the key.
    boot: serial
    You can type serial if you are connected through console, after that it will check for existing installations and will ask you if you need to install a NAC Manager or Server:
    Please choose one of the following configurations:
    1) CCA Manager.
    2) CCA Server.
    3) Exit.
    You choose 1 or 2 depending on the server type. The software will install and the server will reboot.
    After the reboot, you login as root and automatically the configuration utility will launch by itself and you will set the basic parameters:
    CentOS release 5.3 (Final)
    Kernel 2.6.18-128.1.10.el5PAE on an i686
    nacmanager login: root
    Welcome to the Cisco Clean Access Manager quick configuration utility.
    Note that you need to be root to execute this utility.
    The utility will now ask you a series of configuration questions.
    Please answer them carefully.
    Cisco Clean Access Manager, (C) 2011 Cisco Systems, Inc.
    Configuring the network interface:
    Please enter the IP address for the interface eth0 []: 172.30.1.1
    You entered 172.30.1.1 Is this correct? (y/n)? [y]
    etc......
    Hope this helps.
    Regards,

  • [solved]can't run java apps from command line

    Every Java program that i've tried to run from command line gives me a error message like this:
    augusto java% java Test
    Exception in thread "main" java.lang.NoClassDefFoundError: Test
    Caused by: java.lang.ClassNotFoundException: Test
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: Test. Program will exit.
    `java Test.class` doesn't work too.
    but, the exact same code work from eclipse, am I missing something?
    Some info:
    % ls Test*
    Test.class Test.java Test.java~
    % cat Test.java
    public class Test{
    public static void main(String[] args){
    System.out.println("doesn't work");
    % echo $PATH
    /home/augusto/.bin:/home/augusto/.bin:/home/augusto/GNUstep/Tools:/opt/GNUstep/Local/Tools:/opt/GNUstep/System/Tools:/bin:/usr/bin:/sbin:/usr/sbin:/opt/java/bin:/opt/java/jre/bin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/opt/qt/bin
    Last edited by hack.augusto (2009-10-27 00:57:53)

    also make sure that you current directory is in your classpath.
    eg
    export CLASSPATH=".:$CLASSPATH"
    java Test
    your issue is more likely to be classpath related, as java doesn't read the path variable, and the java executable is found
    Last edited by bruce (2009-10-27 01:02:51)

  • Can not run Apache (sudo apachectl start) on OS X 10.8

    I want to start Apache on OS X Mountain Lion 10.8. I type this on the terminal:
    sudo apachectl start
    and press enter. It asked me to enter password. I don't have set any password for my system. So I press enter again. But it does not accept my blank password. After 3 times, it quits the execution of the sudo command.
    I type: "httpd -v" at the terminal and get the following output:
    Server version: Apache/2.2.22 (Unix)
    Server built:   Jun 20 2012 13:57:09
    Can you please tell me, what should I do to run Apache, using sudo command? I also set a password for the system in the Preferences > Users and Groups, and I am sure that I have administrator privilages (the "Allow user to administer this computer" is checked).

    I clicked on "This solved my question" by mistake; I know that I have to enter the system password. In fact it's obvious. But I told that I have not set any password on my system. So I just press enter for a blank password. And it asks again for the password. After 3 times, it ends.
    I also set a password and try again, but it didn't work.

  • How can i run a java class file from shell?

    Hi all,
    I've a .class file named "File" that contains Main method, it is in the package "File2".
    How can I run it by shell command?
    PS: "java -cp . file" doesn't work it launch->
    Exception in thread "main" java.lang.NoClassDefFoundError: File2/File (wrong name: File2/File)
    Thanks in advance.

    Just to understand: is File2 ar jar archive or not? If it is a jar archive, have you tried open File2.jar? If File2 is a directory within the current directory, have you tried java -cp . File2/File? I just tested with a set of classes and it works... Let me be precise:
    * Let us imagine you are working in a directory whole path is PathToDir/
    * in this directory you have the classes put in a directory called File2
    * in order to launch File.class then you would have to invoke :
    cd PathToDir/ (just to be sure)
    java -cp . File2/File
    *if you were to do the following then you would have the problem you describe
    cd PathToDir/File2/
    java -cp . File

  • Running Oracle Scripts from Command Line

    Hi,
    How can i run Oracle scripts from command line.
    Actually i need to run these scripts from MSBuild before running Unit test projects

    C:\>sqlplus @myscript
    That would be the easiest variation
    C:\>sqlplus user/passwd@tns_alias @myscript
    would be an often used variation
    And then there is of course the version with parameter passing:
    C:\>sqlplus user/passwd@tns_alias @myscript param1 ... paramx
    Dunno about MSBuild

  • Sudo Command in Bash Script

    So I created a simple bash script to run on login.....
    one of the commands is the following:
    sudo "something something something"....
    One thing I haven't learned in my years of Unix is how do you get a bash script to run a sudo command without having to enter a password?  I know this is trival, but just a quick 'this is how you do it' would be cool.
    Thanks ahead of time on this really dumb question.

    There's a few ways to do this.  Here's two (pick the method you like):
    Method 1: Using "askpass".
    With this you always do sudo -A command.  The -A argument tells sudo to execute a command that echos the password to stdout.  That command is something you write.  For this explaination let's call the command pw and stick it /usr/local/bin.  So it's full pathname would be /usr/local/bin/pw.
    sudo -A can get the pathname to pw a number of ways.
    1. From the sudoers file.
    Use visudo to add the following line to the sudoers file:
    Defaults:ALL    askpass=/usr/local/bin/pw
    2. Using the SUDO_ASKPASS environment variable.
    export SUDO_ASKPASS=/usr/local/bin/pw
    This might work too (assuming SUDO_ASKPASS has been previously exported):
    SUDO_ASKPASS=/usr/local/bin/pw sudo -A command
    Method 2: Have sudo read the password from stdin
    echo -n password | sudo -S command
    The -S option tells sudo to read the password from stdin so echo pipes it in (without the ending newline).
    The only relatively secure scheme of these two methods is the askpass (-A) method.  At least with that method you have a chance of encrypting/hiding your password down in the command that echoes it to stdout.  The -S method would contain your password explicitly in a script somewhere unless you make other provisions to encrypt/hide it with that technique.

  • -bash: sudo: command not found

         Hello all,
    I have had WAY too many problems with this laptop, and at this point in its miserable little life, I've decided to just wipe the hard drive and start fresh, not caring at all what happens to the files left on there. As previously stated in one of my earlier questions (That was, might I add, never fully answered.), this late 2008 MacBook (aluminum) has a problem where it does not boot up, and just endlessly shows the gray spinning pinwheel. Four months later, that just stops, and now when trying to boot up with my normal startup disk, it brings me right to the Recovery disk and tries to reinstall OS X. I tried, it failed 5 minutes in. So I tried to wipe the hard drive, and it says:  Disk Erase failed with the error: Couldn't unmount disk.   I looked it up and I saw that if I went into the Terminal and typed: sudo diskutil unmountDisk /dev/disk0 , it would unmount the disk. But whenever I type that, it says: -bash: sudo: command not found. I have no idea how to fix this, and I would really like to be able to use my laptop again without giving somebody my money to do it for me.
                                                 Thanks,
                                                      Luke

    Clean Install of Snow Leopard
    Be sure to make a backup first because the following procedure will erase
    the drive and everything on it.
         1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
             with your computer.  Insert the disc into the optical drive and restart the computer.
             After the chime press and hold down the  "C" key.  Release the key when you see
             a small spinning gear appear below the dark gray Apple logo.
         2. After the installer loads select your language and click on the Continue
             button. When the menu bar appears select Disk Utility from the Utilities menu.
             After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
             size.)  Click on the Partition tab in the DU main window.  Set the number of
             partitions to one (1) from the Partitions drop down menu, click on Options button
             and select GUID, click on OK, then set the format type to MacOS Extended
             (Journaled, if supported), then click on the Apply button.
         3. When the formatting has completed quit DU and return to the installer.  Proceed
             with the OS X installation and follow the directions included with the installer.
         4. When the installation has completed your computer will Restart into the Setup
             Assistant. After you finish Setup Assistant will complete the installation after which
             you will be running a fresh install of OS X.  You can now begin the update process
             by opening Software Update and installing all recommended updates to bring your
             installation current.
    Download and install Mac OS X 10.6.8 Update Combo v1.1. You may then open App Store, click on the Purchases icon in the toolbar, and re-download any OS X upgrade you purchased except Mavericks. Since Yosemite has been released the App Store may not let you re-download Mavericks, but it will let you download Yosemite.

  • Applescript for running sudo commands in terminal

    I'm a newbie when it comes to Applescript and was wondering if someone could help with a basic request. I need to write a small script to do the following:
    1. Launch terminal
    2. Run the 'Sudo -s' command
    3. Enter the administrator password (in plain text)
    and then
    4. run some sudo commands like "sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add administrator"
    I actually WANT the administrator password to be in the script in plain text even though I understand the security risks (I will literally be the only person to ever see the script). I've trawled forums all over but can't seem to find what I am looking for and cannot get it working by patching together the various commands I have found. Thanks in advance for any help you can give!
    Sean

    I've included two examples.  The preferred way & the hacker way.
    with administrator
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    This version has an inline password.
    Notice the echo 'password' |
    The single quotes are no accident.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "echo 'password' | sudo ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • Run a sudo command on system startup via Applescript?

    Hey, I'm trying to hide the Spotlight icon on my menu bar using the sudo command shown here:
    http://osxdaily.com/2011/12/12/hide-spotlight-menu-icon-mac-os-x-lion/
    It works fine, but when I reboot my Mac (I tend to turn it off at night since it has a habit of waking from sleep by itself) the icon has re-appeared, and I need to run the command again.
    I'd ideally like to write an Applescript to run on launch to execute the two commands (which also requires entering my password), but I've not been successful, I get various errors talking about authentication and such.
    Is there an easier way to get this icon permanently hidden? I use Alfred, so while I make use of the Spotlight index, I never touch the magnifying glass icon, and I like to keep a clean menu bar!

    You don't need applescript. What you need to create is a LaunchAgent. Lingon (available through the App Store) can help you write it. But, there are other sources that can show you how to write the raw file and put it in the LaunchAgents folder, like here: http://www.devdaily.com/mac-os-x/launchd-examples-launchd-plist-file-examples-ma c

  • How many times can I run PSConfig.exe -cmd upgrad .... command

    I'm getting VSS error in my eventlog -> application. I was getting 8213 and followed http://technet.microsoft.com/en-us/library/cc734219(v=ws.10).aspx and
    now I'm gettting 8230.
    Meanwhile my backups not are running. I remember running PSConfig command when I first installed windows and sharepoint 2010 on this box for system backup to work correctly.
    Now I run WMIC  QFE  LIST  FULL /Format:HTable > C:\Temp\HotfixList.html to retrieve all the installed update to check if KBs
    2460045 or 2687453 are installed unnoticed but I don't have any history of installed updates suprising eh!
    Now I want to run
    PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent
    -install -cmd installfeatures
    just incase one of them have been installed unnotice.
    How many times can I run this PSConfig command? How dangerous is this decision?

    You can run it as many times as you want, but it will take SharePoint down on that particular server (resets IIS, for example), while it executes.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • How can I run Runtime.exec command in Java To invoke several other javas?

    Dear Friends:
    I met a problem when I want to use a Java program to run other java processes by Runtime.exec command,
    How can I run Runtime.exec command in Java To invoke several other java processes??
    see code below,
    I want to use HelloHappyCall to call both HappyHoliday.java and HellowWorld.java,
    [1]. main program,
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloHappyCall
         public static void main(String[] args){
              try
                   Runtime.getRuntime().exec("java  -version");
                   Runtime.getRuntime().exec("cmd /c java  HelloWorld "); // here start will create a new process..
                   System.out.println("Never mind abt the bach file execution...");
              catch(Exception ex)
                   System.out.println("Exception occured: " + ex);
    } [2]. sub 1 program
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloWorld
         public static void main(String[] args){
         System.out.println("Hellow World");
    } [3]. Sub 2 program:
    package abc;
    import java.util.*;
    import java.io.*;
    class HappyHoliday
         public static void main(String[] args){
         System.out.println("Happy Holiday!!");
    } When I run, I got following:
    Never mind abt the bach file execution...
    I cannot see both Java version and Hellow World print, what is wrong??
    I use eclipse3.2
    Thanks a lot..

    sunnymanman wrote:
    Thanks,
    But How can I see both programs printout
    "Happy Holiday"
    and
    "Hello World"
    ??First of all, you're not even calling the Happy Holiday one. If you want it to do something, you have to invoke it.
    And by the way, in your comments, you mention that in one case, a new process is created. Actually, new processes are created each time you call Runtime.exec.
    Anyway, if you want the output from the processes, you read it using getInputStream from the Process class. In fact, you really should read that stream anyway (read that URL I sent you to find out why).
    If you want to print that output to the screen, then do so as you'd print anything to the screen.
    in notepad HelloWorld.java, I can see it is opened,
    but in Java, not.I have no idea what you're saying here. It's not relevant whether a source code file is opened in Notepad, when running a program.

  • How can i run application client from the command prompt ?

    Hi,
    I'm new to java & EJB. so can any body tell me the command to run the application client from the command prompt. Here is the code to print hello world:
    /* Remote interface */
    public interface Hello extends javax.ejb.EJBObject
         public String hello() throws      java.rmi.RemoteException;
    /* Home interface */
    public interface HelloHome extends javax.ejb.EJBHome
         Hello create() throws java.rmi.RemoteException, javax.ejb.CreateException;
    /* Stateless session bean class */
    public class HelloBean implements javax.ejb.SessionBean
         private javax.ejb.SessionContext ctx;
         public void ejbCreate(){
              System.out.println("ejbcreate()");
         public void ejbRemove(){
              System.out.println("ejbRemove()");
         public void ejbActivate(){
              System.out.println("ejbActivate()");
         public void ejbPassivate(){
              System.out.println("ejbejbPassivate()");
         public void setSessionContext(javax.ejb.SessionContext ctx){
              this.ctx=ctx;
         public String hello(){
              System.out.println("hello()");
              return "Hello, world!";
    /*Client class */
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Properties;
    public class HelloClient
         public static void main(String[] args) throws Exception{
              Properties props=System.getProperties();
              Context ctx=new InitialContext(props);
              Object obj=ctx.lookup("HelloHome");
              HelloHome home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
              Hello hello=home.create();
              System.out.println(hello.hello());
              hello.remove();
    I have stored .java files in c:\ejb
    I have successfully created the .class files using javac command in the following directory :
    c:\ejb
    I have also created Helloworld.ear file in c:\ejb using sun application server which contains the following files:
    ejb-jar-ic.jar
    app-client-ic.jar
    sun-j2ee-ri.project
    application.xml
    sun-application.xml
    Manifest.mf
    But the problem is that i'm not able to run the HelloWorld.class file successfully from the command prompt. So please suggest me the comand.
    Thanx in advance.
    Best regards,
    Pankaj

    Hi
    You can run this code from the command prompt in the same way as you run any other simple java program. The only thing is you need to set the Home and Local interfaces in the classpath.And obviously if u had deployed the bean in ur app server container, then its all over.
    And one more thing is that u need to set the provider URL in the InitialContext created in the client program.
    Thanks
    Arun B

  • Can't run command because user is in read-only mode.

    Hi
    I try to execute any sql statment i am getting this error.
    Can't run command because user is in read-only mode.

    user493528 wrote:
    I am having the same issue with Benthic when I do the With clause.
    I understand this is not related to Oracle but did anyone had issue related to this. I am getting the same error. Is it related to ODBC driver of how Benthic use to connect etc.,? I do not know.
    Thanks
    Gopihttp://www.benthicsoftware.com/support.html

Maybe you are looking for

  • Verificação de NF-e de entrada dispara proxy da versão errada

    Pessoal, estou fazendo alguns testes com o B2B de entrada e notei um possível BUG/Falha na minha customizing. Quando envio uma NF-e na versão 2.0 para a interface NFB2B*, ele entra normalmente no GRC e grava na /XNFE/XMLIN. O problema é quando ele di

  • Slate 500 Windows install problem

    I format my HP Slate 500 64 GB SSD.  Now i select Disk 0 Partition 2 ( 59.2 GB free space. Primary) but is not start and this message in the screen   " setup was unable to create a new system partition or locate an existing system partition. See the

  • Enhanced Flash Builder Code Generation Functionality

    For voting in JIRA: https://bugs.adobe.com/jira/browse/FB-27169 The code generation feature FB 4 currently has is only really useful for quick throwaway prototyping or very simple forms. The generation should allow you to configure formatting via def

  • Format not changed in runtime....help me

    Hi experts, i am doing proxy to file.. i have done some transformations using UDFs in mapping....when i tested the maping in IR its working fine ... but when i executed the proxy to test end to end....in sxmb_moni ,response pay load showing with redf

  • White thumbnails in Library module (CC 2015)

    hi, with the new version of Lightroom (CC 2015) I've got a very annoying problem: some miniature in the library module is totaly white, the picture doesn't exist for LR, but the picture really exist in their original folder. someone can give me some