google-chrome <filepath> shows error. Access Google Chrome from Terminal - google-chrome

I am trying to open a file in google-chrome from my terminal. Whenever I run command google-chrome on Terminal, it says:
zsh: command not found: google-chrome
Terminal Screenshot
How should I go about it?

Related

Launch Chrome with command line switches has no effect

I type these code below on windows cmd.
with switch --version
"C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Default" --version
without switch --version
"C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1"
then type chrome://version/ on browser for each.
In this case you will see all of both with switch --version on command line property.
could i have this reason? Thanks.

PATH to mysql is saved in .zshrc but does not show on echo $PATH. mysql --version gets "Command not found" error

I downloaded and installed mysql via their package installer. It installed successfully and I can verify that the server is running.
mysql server status
When I enter mysql --version I get the zsh: command not found: mysql error.
terminal and .zshrc
I added the path /usr/local/mysql/bin(I verified the location) in .zshrc and restarted the terminal, it doesn't show on the echo and the terminal still says "command not found"
I've also added it on a separate line via - echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.zshrc , and still get the error.
What am I doing wrong?

Google Chrome won't install on Mac

I'm having a hard time getting Google Chrome to open correctly on my MacBook Pro. I'm using MacOS High Sierra 10.13.6. I'm trying to install Chrome version 69.0.3497.100. I've tried to install using different methods, including homebrew. It appears to install OK, but the app just won't open when I try to click on it in the Applications folder. I'm getting this error when I try to start from the command line:
> Last login: Fri Oct 12 14:15:57 on ttys001 18-0502:~ rgoldman-local$
> /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ; exit;
> crashpad_handler: --database is required Try 'crashpad_handler --help'
> for more information. [1012/145514.178846:ERROR:file_io.cc(89)]
> ReadExactly: expected 8, observed 0
> [1012/145514.179295:ERROR:crash_report_database_mac.mm(95)] mkdir : No
> such file or directory (2) logout Saving session... ...copying shared
> history... ...saving history...truncating history files...
> ...completed.
>
> [Process completed]
This is most likely an access issue, where Chrome does not have access to the necessary locations to add directories and content. Try these steps:
Open a terminal window.
In the terminal window, there will be a username in the command prompt of the window. Mine looks like this:
Last login: Tue Aug 27 09:51:28 on ttys000
jacobs-mbp:~ jyackeno$
you want the text between the '~' and the '$'. That's your username for the mac.
As an example:
My username (from above) is jyackeno.
now, type this into the Terminal window:
sudo chmod 777 /Users/username-from-terminal/Library/Application\ Support/Google/chrome
AND change:
username-from-terminal
with the text between the '~' and the '$' from the earlier step.
As an example:
The command I enter is:
sudo chmod 777 /Users/jyackeno/Library/Application\ Support/Google/chrome
You will be prompted to enter a password. Enter your mac login password.
Now try starting Chrome. It should start successfully.
The actual binary to launch Google Chrome is "/Applications/Google\ Chrome.app/Contents/MacOS/GoogleChromeOrWhateverTheBinaryIsCalled"
And if that fails (The suggestion I'm about to make is not recommended by the tech communtiy), try adding "sudo" before the binary (space after sudo) and try launching it one more time

How to run google chrome headless in docker?

My problem is how to run google chrome in docker container for e2e testing.
I create a Dockerfile from official Jenkins image, but when try to run google chrome, it crashes and show the error:
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
Trace/breakpoint trap (core dumped)
The Jenkins docker image uses Debian jessie.
I can run google chrome with --headless flag and the X server is not needed.
This is my docker file:
https://github.com/ripper2hl/jenkinswithchrome
Jenkins official image:
https://github.com/jenkinsci/docker
The repo a person runs google chrome with GUI from docker:
https://github.com/jessfraz/dockerfiles/blob/master/chrome/stable/Dockerfile
My first approach is to use xvbf, but the process is more simple when used --headless flag.
https://gist.github.com/addyosmani/5336747
I can run chrome in Ubuntu server with the same commands for installation, but in docker it fails.
After other intents, I used --no-sandbox flag, but docker images shows the next error.
[0427/180929.595479:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
[0427/180929.595537:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
Actually I ran this command:
google-chrome-stable --headless --disable-gpu --no-sandbox http://www.google.com
Just launch chrome with --no-sandbox that s resolves the problem
Using this image alpeware/chrome-headless-trunk worked for me in ubuntu!
The command used in that container to launch headless chrome is this:
/usr/bin/google-chrome-unstable \
--disable-gpu --headless --no-sandbox \
--remote-debugging-address=0.0.0.0 \
--remote-debugging-port=9222 --user-data-dir=/data
here's a short video of the container in action
I launched the container in Ubuntu with this command:
docker run -it --rm -p=0.0.0.0:9222:9222 \
--name=chrome-headless \
-v /tmp/chromedata/:/data alpeware/chrome-headless-trunk
then used Chrome to connect to the debug port at localhost:9222
With some modifications you could probably get this running in Jenkins!
Sources
https://hub.docker.com/r/alpeware/chrome-headless-trunk/
https://github.com/alpeware/chrome-headless-trunk
This article is exactly what I needed to run Karma tests with Headless Chrome inside docker:
https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3
Basically, the solution is to run Headless Chrome with the --no-sandbox flag.
We built a Docker image with Chrome and Chromedriver that runs Chrome in headless mode for automated tests. We're using this as a drop-in replacement for PhantomJS in our docker-compose.yml setups. The image is based on Alpine Linux and doesn't need or include Selenium so it's pretty small.
Source:
https://github.com/retreatguru/headless-chromedriver
Docker Hub:
https://hub.docker.com/r/retreatguru/headless-chromedriver
I don't have the answer but I know a container which successfully launch a headless Chrome in Docker. The selenium one:
Selenium Chrome Node
I use it for automated testing of my webapp in Chrome
Hope it helps
I extend default Dockerfile Selenium Chrome Node by following
FROM selenium/standalone-chrome-debug:latest
MAINTAINER Serge Arbuzov <Serge.Arbuzov#advantechwireless.com>
USER root
### jenkins set up ###
RUN apt-get update && apt-get install -y openssh-server sudo
RUN mkdir /var/run/sshd
RUN adduser jenkins
RUN echo jenkins:jenkins | chpasswd
RUN echo "jenkins ALL=(ALL) NOPASSWD:ALL">>/etc/sudoers
USER root
RUN echo export DISPLAY=":1.5" >> /etc/environment
ADD run.sh /run.sh
RUN chmod +x /run.sh
EXPOSE 22
CMD ["/run.sh"]
And my run.sh is
#!/bin/bash
Xvfb :1 -screen 5 1024x768x8 &
/usr/sbin/sshd -D
So i can use default image as Jenkins node

How can I access the mysql command line tool when using XAMPP in OS X?

I've got a vanilla install of XAMPP in OS X. How can I access the mysql command line tool? I've tried typing "mysql" at the command line, and it spits back "-bash: mysql: command not found".
XAMPP is installed in Mac OS X in the following directory:
/Applications/XAMPP/
You can look what's inside that directory and run mysql command line tool providing the full path to it:
$ /Applications/XAMPP/xamppfiles/bin/mysql
If you need, you can modify your PATH environment variable to include XAMPP binaries and you won't need to specify the whole path all the time.
Open your .profile file in Mac. This can be done by entering the terminal and typing
pico ~/.profile
Add the following line to your ./profile file. Replace the path where you installed Xampp, however by default this is the route and should work:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
Open a new terminal window (Recommendation is to quit all terminal windows and then reopen) and type:
mysql
That is all, isn't easy!!
Before using the mysql command, make sure that you start up the server first by running
$ mysql.server start
Then you will be able to use the commands mysqladmin and mysql.
To shut it down, run
$ mysql.server stop
and to restart just use
$ mysql.server restart
Very intuitive.
Open terminal and Follow this bellow step to add mysql to your mac environmental variable
step 1:
sudo nano ~/.bash_profile
step 2:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
save it by control+x and then y and hit return. That's it!! now close the terminal and reopen
mysql --version
this will tell you which MySQL version you are using with xampp
Since I cannot comment on the accepted answer by Pablo Santa Cruz - Here's some additional info. If you're going to modify your PATH environment variable to include XAMPP binaries, make sure you add
/Applications/XAMPP/xamppfiles/bin
and not
/Applications/XAMPP/xamppfiles/bin/mysql
to the /etc/paths file. To do this run the command
sudo nano /etc/paths
then add the path to the file. Save using Ctrl+O and exit using Ctrl+X. Quit terminal and open again.