Results 1 to 8 of 8

Thread: Terminal problem in macOS 12 (Monterey)

  1. #1
    Join Date
    Jun 2012
    Location
    Scotland
    Beans
    158
    Distro
    Ubuntu 16.04 Xenial Xerus

    Terminal problem in macOS 12 (Monterey)

    I'm in the process of migrating all of my work from an iMac running macOS 10.14.6 (Mojave) to a new iMac running macOS 12.2.1 (Monterey).

    On the older system, I'd had an alias that I'd created in Terminal that enabled me to ssh into a machine running Ubuntu. It was (I'm not adept at Terminal commands - I was shown them by good folks on this site):
    nano ~/.bash_profile (return)

    alias fah='ssh me@me-xxxxx-xxx-xx.local'

    Then ControlO to save the alias and ControlX to exit nano.
    Quit and re-open Terminal.

    After that, all I had to do was type 'fah' (followed by the password for the Ubuntu machine).

    The problem now is that the default shell displayed in Terminal on the new machine is 'zsh' and that command doesn't work.

    Can anyone help me to create a new command for zsh?

    I want to be able to do this because I'm running the Ubuntu machine without monitor, keyboard and mouse.
    Last edited by howefield; March 2nd, 2022 at 05:26 PM. Reason: reset font size to default.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Terminal problem in macOS 12 (Monterey)

    I wouldn't expect zsh to use the bash_aliases file. Which file is used normally for zsh aliases? Modify that.
    But https://zsh.sourceforge.io/Intro/intro_8.html has examples of zsh aliases. Seems those should be the same. As a guess, I'd expect ~/.zshrc to the typical zsh startup file. Try that.

    You could just change the default shell to bash. chsh is the command for that. I don't know if there are addition impacts. zsh is sorta niche on Unix. Probably a fine shell, but if you don't want to change, then you don't have to.

  3. #3
    Join Date
    Jun 2012
    Location
    Scotland
    Beans
    158
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Terminal problem in macOS 12 (Monterey)

    Thanks for your reply.

    I tried substituting zsh for bash in the first command to make it: nano ~/.zsh_profile
    but it didn't work.

    I'm a real amateur with this stuff. Just want to make it work.

    I looked in the link you posted, but it was way above my head I'm afraid.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Terminal problem in macOS 12 (Monterey)

    You've completely lost me.

    Did you put that same alias line in the ~/.zshrc file, logout, login, be happy? Obviously, make the owner, group and permissions of the ~/.zshrc match whatever the old file used.

  5. #5
    Join Date
    Jun 2012
    Location
    Scotland
    Beans
    158
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Terminal problem in macOS 12 (Monterey)

    Sorry if I haven't described what I did properly. I think you might need to shift down a few gears here. I'm really slow.


    Originally in Terminal on my older iMac:


    nano ~/.bash_profile (return)


    alias fah='ssh me@me-xxxxx-xxx-xx.local'


    Followed by:


    ControlO to save the alias and ControlX to exit nano.


    I attempted, on the newer iMac:


    nano ~/.zsh_profile (return
    alias fah='ssh me@me-xxxxx-xxx-xx.local'


    Didn't work. ‘Command not found’, which makes me think the alias wasn’t saved.

  6. #6
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Terminal problem in macOS 12 (Monterey)

    You have to logout and login to have the init files seen.

  7. #7
    Join Date
    Jun 2012
    Location
    Scotland
    Beans
    158
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Terminal problem in macOS 12 (Monterey)

    To show how slight my grasp is of all of this, what do you mean 'init files'?

    Another question - when I use the Control+O followed by Controll+X, should the nano screen be replaced by the usual Terminal window I was in to begin with?

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Terminal problem in macOS 12 (Monterey)

    init files === initialization files. I was just lazy.

    At login, on every Unix-like OS, including OSX, Linux, Unix, UNIX, AIX, HP-UX, Solaris, Digital Unix, and all the BSDs ... there is an order for which files get looked at and "sourced" to run programs. We only care about init files for end-user logins. Those are shell specific and usually clearly documented. But, since these init files are little scripts, they can (and do) include other files to add more settings and start other programs. I don't use zsh, but every other shell does this. The default file - the init file - for zsh is ~/.zshrc. It is hard coded in the program. ~/.zshrc is identical to $HOME/.zshrc.

    I don't use nano and purge it from all my systems as a matter of policy to prevent ever seeing it. Sorry. There's usually a menu at the bottom showing the commands, if I recall correctly. Why use nano if that is hard? Use whatever editor you like. There must be 50 of them.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •