ntpdate command not found in MacOS Mojave - bash

I have a Bash script who update the time of my mac but since the update of Mojave the command isn't found:
ntpdate -u time.apple.com
return :
ntpdate: command not found
Where am I going wrong?

It's a duplicate. Please check this stackoverflow question.
TL;DR use sudo sntp -sS time.apple.com instead.

For anyone trying to do this because their vm cannot connect to the update server while trying to install macos on a virtual machine, I switched my network adapter from NAT to bridged and the issue was resolved.

Related

Forticlient VPN from mac CLI

I'd like to make a script to connect to different SSL VPN's from MAC OS X. I cannot find any info as to how to connect VPN's via command line? Can anyone please help me with this?
Thanks!
There is actually a way. First, install openfortivpn via brew:
brew install openfortivpn
Then, connect as such:
sudo openfortivpn <server_ip>:<server_port> -u <username> -p <password>
After some research I have come to conclusion there is no FortiClient CLI for MAC OS. In other words there is no commands for FortiClient in terminal. Still you can use terminal for Backup/Restore/Export for FortiClient VPN configuration. You can use this link for reference:
FortiClient XML Reference Guide

How to install hcitool in mac os terminal

Hello there guys i have been trying to use hcitool on mac os terminal but whenever i type hcitool scan the following error is appeared -bash: hcitool: command not found i have tried pip install hci and pip install hcitool but the following error is shown
ERROR: Could not find a version that satisfies the requirement gatttool (from versions: none)
ERROR: No matching distribution found for gatttool
please help me with this
Commands such as hcitool, gatttool, hciconfig, etc. are part of the BlueZ package which works on Linux only. MacOS on the other hand is UNIX-core and therefore the commands will not run on a MacOS operating system. There have been hacks before to get some sort of functionality on MacOS OSs but the solution is always incomplete.
Your next best bet will be to use a Virtual Machine running a Linux guest (e.g. Ubuntu) and then use the BlueZ commands from within that VM OS.
I hope this helps.
Get yourself a Docker container up and running. You can write scripts that you keep in a shared volume between the host and the container (meaning you don't have to log into the container). You can then execute those scripts from your OSX terminal, to run in the container.
HTH

Having trouble getting docker to work on mac

OK so here is what I have done so far. I installed docker for mac, and that worked fine. From there I tried to get a project up and running using docker-compose and I got the following error:
Could not read CA certificate "/Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem": open /Users/<useraccountfolder>/.boot2docker/certs/boot2docker-vm/ca.pem: no such file or directory
So I tried to fix it by trying this accepted answer. This is when I got another error, Host does not exist: “default”. This is when I trie this accepted answer, but when I tried to run docker-machine create default, I got this error: Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path". I am just lost at this point. Any help?
To use docker machine you need the latest version of VirtualBox, from the docker docs:
IF YOU ARE USING DOCKER FOR MAC
Docker for Mac uses HyperKit, a lightweight macOS virtualization solution built on top of the Hypervisor.framework in macOS 10.10 Yosemite and higher.
Currently, there is no docker-machine create driver for HyperKit, so you will use virtualbox driver to create local machines. (See the Docker Machine driver for Oracle VirtualBox.) Note that you can run both HyperKit and Oracle VirtualBox on the same system. To learn more, see Docker for Mac vs. Docker Toolbox.
Make sure you have the latest VirtualBox correctly installed on your system (either as part of an earlier Toolbox install, or manual install).
Source: https://docs.docker.com/machine/get-started/#prerequisite-information
OK so I found a solution which is probably not fixing the root issue, but it does work. To unset previous variables I ran this command unset ${!DOCKER*}. This worked, but then I had to run it every time I started a new terminal session, so I added it to my .bash_profile and now I am good.

Homebrew installation on Mac OS X Failed to connect to raw.githubusercontent.com port 443

When I try to install Homebrew, I am getting following connection refused error. Please help me to solve this problem.
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Works for me. Unless its a real problem with github, which it may be but I'm going to guess that its not, its probably a problem with your connection.
Can you get to the same URL via a browser?
https://raw.githubusercontent.com/Homebrew/install/master/install
If you get an error there too, you know what your problem is. (Talk to your network admin)
If that works...maybe try doing just the "curl" command in your terminal to see if curl gives a more specific error?
Also, if that does work, save that file to a file on your computer (brew_install.rb) and then run it via
ruby brew_install.rb
If you are behind a proxy, try this:
sudo vim /etc/hosts
#add the line below and :wq
199.232.28.133 raw.githubusercontent.com
The accepted Answer is outdated now. But based on the answer I solved the problem by:
open the home page of brew https://brew.sh/
copy the URL from the install cmd and open it on your browser https://raw.githubusercontent.com/Homebrew/install/master/install.sh
right-click and save it to your computer
open a terminal and run it with: /bin/bash path-to/install.sh
It was a company proxy problem for me and the solution as mentioned here worked for me.
export HTTPS_PROXY=https://<proxy.mycompany>:<port>
git config --global https.proxy $HTTPS_PROXY
git config --global --get https.proxy
I had the same error,
- Disabled VPN
tried again installing without VPN
It worked for me.
There are several situations here, you can do following things :
reinstall the xcode command line tool by removing the old tools ($ rm -rf /Library/Developer/CommandLineTools) and xcode-select --install
request web page
https://raw.githubusercontent.com/Homebrew/install/master/install
then save it's content to shell file then run it.
change your DNS server to 8.8.8.8 (This is worked for me : ] )
Finally you should run /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
First try to open the link in the browser if it doesn't open then changing the DNS is the answer.
For me changing the DNS to 8.8.8.8 worked for me.
DNS settings can be searched for in the system setting which can be launched through spotlight in Mac OS and then changed.
This solved the pertinent issue for me.
I've seen this a few times on other people's machines and it seems to be fixed after you install xcode, i.e. xcode-select --install
The method of using ruby is probably outdated, as shown below:
As a better alternative, please set your computer's DNS server to 8.8.8.8
These steps solved the problem:
xcode-select --install
restart the Mac
Execute this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and it should work.
Check is https proxy is set
env|grep -I proxy
Then if it is set, remove the env variable
unset HTTPS_PROXY
I solved this problem by the following steps:
removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
Although saving the shell file locally and then running it can solve this problem, but you'll meet it again when you do something similar(e.g. install oh-my-zsh, vim-plug, etc.)
At last, I find the 3rd item of this answer(https://stackoverflow.com/a/61787208/5458745) works best for me, as it can also solve the problem I meet when installing other tools using curl. However instead of changing the DNS, I add 8.8.8.8 to my original DNS server list, which works fine for me.
Change your DNS server to 8.8.8.8 (This is worked for me)
I solved it.
You can visit https://github.com/Homebrew/install/blob/master/install.sh to get this install.sh by copy the whole contents.
Then paste it into install.sh and run sh install.sh.
A combination of what #blueskin mentioned first and then what #Ferenc Yim mentioned is what worked for me.
The script also requires sudo access (not necessarily run with a sudo prefix just need admin access)
sudo vim /etc/hosts
Once the vim code editor is open add the following line at end of the file
199.232.68.133 raw.githubusercontent.com

RabbitMmq on Mac can't start

I've installed rabbitmq on Mac OS X via homebrew, just a simple command:
$ brew install rabbitmq
but, when I start the server via rabbitmq-server, it occurs:
ERROR: distribution port 25672 in use on localhost (by non-Erlang process?)
I want to find some process that uses port 25672, but I can't find that really strange
anyone knows the reason, thx a lot :)
Use sudo lsof -i :25672 to find the process. sudo may or may not be needed depending on user permissions.

Resources