terminal – Change Mappings in X-Quartz for xterm

Like a lot of people, I suspect, my ‘go to’ terminal emulator on Mac is either the vanilla ‘Terminal’ application, or else iTerm2. These don’t really cut it, so I’d like to go back to using xterm. I have a sort of wrapper which I run and it has stuff like:

/opt/X11/bin/xterm -fn 10x20 -sb -sl 1500 -vb -bg DarkSlateBlue -fg white  -title mutt -e "$HOME/bin/mx" &

It opens six xterms for me, each one with a different title. That works, but what I can’t do is use the keyboard to switch between the windows. The ‘Window’ menu says that (for example) xterm 3 is ⌥3. But all that does is to take a screenshot with Skitch.

Is there any way to map any key(s) I want, to achieve this?

Thanks.

mac os – Ejecutar función bash en terminal abierta cada cierto tiempo o al hacer focus (iterm2)

estoy creando una porción de código en bash que abre terminales en light o dark mode dependiendo del perfil que tenga actualmente el sistema (macos). Actualmente funciona, pero funciona solo al momento de abrirlas. Como es conocido en mac el perfil cambia de light a dark automáticamente según la hora entonces lo que necesito es detectar ese cambio para que se haga automáticamente en las terminales actualmente abiertas.

Para eso se me ocurre ejecutar una función verificadora cada cierto tiempo que lance la función que cambia el modo o capturar el evento cuando se hace focus a la ventana (iterm2) y ejecutar dicha corroboración.

Qué opciones tengo para lograr alguna de las 2 en bash?

*Especial mención en que debo poder seguir utilizando la instancia de terminal normalmente y que el proceso se debe ejecutar en paralelo pero afectar esa ventana.

terminal – Howto revert Homebrew ‘git fetch –unshallow’?

I searched homebrew and he gave me this message:

Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

I run the advised command, but wish to revert it back, because a deep clone is slower than a shallow clone.

I found some docs howto do shallow clone, but I wish to use the same approach like Homebrew project.

terminal – Disable delays when running scripts for the first time

An article about delayed script executions has been published recently. I could reproduce this on my Mac by running the following:

$ echo $'#!/bin/shnecho Hello' > /tmp/test.sh && chmod a+x /tmp/test.sh && time /tmp/test.sh && time /tmp/test.sh
Hello
/tmp/test.sh  0.00s user 0.00s system 0% cpu 3.796 total // <- DELAY!
Hello
/tmp/test.sh  0.00s user 0.00s system 78% cpu 0.004 total

The article states that

Some users have a Developer Tools category in the Security & Privacy preferences pane (I don’t). If your terminal is added to this category, you will not be able to reproduce this delay.

I can’t find this in my settings.

How can I disable whatever Apple is doing here not only for my Terminal, but for all other developer related applications (Xcode, IntelliJ, etc.)?

command line – Copying and pasting between terminal windows adds extra characters

I’ve recently moved from MacOS 10.4 to 10.15. I use Japanese/English/Russian/Chinese, and I’ve noticed a different behavior when copying between terminal windows on 10.15. Extra characters, specifically 00~, 01~ are prepended and appended to my buffer. As an example,

ideas/2020

becomes

00~ideas/202001~

when pasted.
I’m unsure if this issue is a function of the languages or a significant change in behavior in the terminals, but it’s rather bothersome.

Any suggestions on what might inhibit the addition of extra characters in the buffer would be greatly appreciated.

terminal – Guide to the output of the builtin airport command line utility

I am trying to understand the output of the airport command line utility on OSX:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
     agrCtlRSSI: -45
     agrExtRSSI: 0
    agrCtlNoise: -95
    agrExtNoise: 0
          state: running
        op mode: station 
     lastTxRate: 585
        maxRate: 867
lastAssocStatus: 0
    802.11 auth: open
      link auth: wpa2-psk
          BSSID: xx:xx
           SSID: xx
            MCS: 7
        channel: 44,80

While I’d to love how to understand all of the output above, most specifically, I am trying to figure out if there is any way to programmatically get the “Link Speed” as shown in the Network Utility program:

enter image description here

macos – OS X computer name not matching what shows on terminal

It’s perfectly normal for this to occur; when you login Terminal remotely bash does a reverse DNS lookup. It will only be the same if the hostname is not specified on the network you’re connecting from and there is no reply from the DHCP server, or the reverse lookup against the remote DNS server fails to resolve.

You can easily over-ride the default setting by using this command in Terminal:

# sudo scutil --set HostName archos

You can check it by using:

# nslookup nn.nn.nn.nn
( or )
# host nn.nn.nn.nn

(where nn signifies your Mac’s ip address)

terminal – launchd running php script fails under Catalina on exec diskutil

I have a php script that worked perfectly under Mojave from the terminal and as a launchd job. After changing to Catalina, the php script continues fine from the terminal, but the launchd job fails on Catalina. I am using Lingon X to manage the launchd tasks.

Here is the function having the problem:

function isMounted($volume, &$disk_id, &$mountedState)
{
    $disk_id = exec("/usr/sbin/diskutil list|grep $volume|awk '{print $6}'", $output, $ret_var);
    if ($disk_id)
    {
        $mountedState = exec("/usr/sbin/diskutil info $disk_id |grep Mounted|awk '{print $2}' ", $output, $ret_val);
    }
}

The var $disk_id would normally be something like disk2s1, and $mountedState would be either “Yes”, or “No”. The function is used to make sure needed external disks are mounted, and if not, to mount them.

Some output related to the isMounted function from the properly running script in a terminal:

====================
Run local backup for 20200519 starting: 2020-05-19 20:12:08
20:12:09 disk_id=disk2s1
20:12:09 isMounted=No
20:12:09 disk2s1 mounted

Here are my observations, all of which pertain only when running under launchd on Catalina:

  1. The problem is that the call to exec(“diskutil”) fails seemingly randomly in a variety of ways in a launchd job on Catalina. It seems that generally the first call to diskutil will work, but the second one always fails, returning no value and no output. As one experiment I put sleep(X) between the two calls, where X could be from 3 to 10; this had no effect. As another experiment, I reversed the order of the calls (and adjusted the parameters appropriately); the first call worked, but the second call did not.

  2. Sometimes the exec diskutil calls work don’t return anything as a value or in $output. That is, running multiple tests gives different results.

  3. In desperation, I even wrote a version that only makes on exec call, and was parsing both the $disk_id and $mountedState in php. In that version, diskutil refused to return anything.

Note: Some suggestions about forcing the shell to /bin/bash had no effect/usr/.

In Mojave, both the terminal and launchd worked fine; but under Catalina, the identical script will not work from launchd.

terminal – “You must specify a volume path” Trying to create an ISO file

I’m trying to create an ISO file of Mojave, in my Mac with Catalina with these commands (I already have the installer of Mojave in Applications)

hdiutil create -o /tmp/mojave -size 7900m -volname mojave -layout SPUD -fs HFS+J

hdiutil attach /tmp/mojave.dmg -noverify -mountpoint /Volumes/mojave

sudo /Applications/Install macOS Mojave.app/Contents/Resources/createinstallmedia – 
volume /Volumes/mojave –nointeraction

hdiutil detach /volumes/Install macOS Mojave

hdiutil convert /tmp/mojave.dmg -format UDTO -o ~/Desktop/mojave.cdr

mv ~/Desktop/mojave.cdr ~/Desktop/mojave.iso

But with this command, I have the problem

enter image description here

What I’m doing wrong?

enter image description here

The operating system of my iMac doesn’t run but I want to take a backup from Recovery OS or the terminal

My OS doesn’t run so I have to reinstall it. But I don’t have any backup from the Time Machine or iCloud (my fault). I don’t want to lose my information. I tried two different things.

First attempt

  1. Connect an external hard drive
  2. Run the Recovery OS
  3. Try to copy my information to the external hard drive

And here’s the problem, I can’t do that. It doesn’t give me any option to do it.

Second attempt

  1. Connect an external hard drive
  2. Run the Single User Mode
  3. Try to copy my information to the external hard drive with commands

And here’s the other problem. It doesn’t recognize the external hard drive. So I tried to mount it with diskutil, I could run that command with help in this forum. But I can’t use it. I tried to disable the SIP from the Recovery mode with csrutil disable but it appears me that is only available in Recovery mode. But I’M IN THE RECOVERY MODE.

Anyway, I don’t know if continue that way, or maybe there are other easier solutions to have my backup. Thank you!