imac 终端中安装Home brew 并通过Home brew安装gdb

一、安装Home brew

terminal中输入

localhost:~ shikaixun$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

效果

==> This script will install:

/usr/local/bin/brew

/usr/local/share/doc/homebrew

/usr/local/share/man/man1/brew.1

/usr/local/share/zsh/site-functions/_brew

/usr/local/etc/bash_completion.d/brew

/usr/local/Homebrew

==> The following new directories will be created:

/usr/local/Cellar

/usr/local/Homebrew

/usr/local/Frameworks

/usr/local/bin

/usr/local/etc

/usr/local/include

/usr/local/lib

/usr/local/opt

/usr/local/sbin

/usr/local/share

/usr/local/share/zsh

/usr/local/share/zsh/site-functions

/usr/local/var

==> The Xcode Command Line Tools will be installed.

···

···

==> Next steps:

- Run `brew help` to get started

- Further documentation: 

    https://docs.brew.sh

二、安装gdb

terminal中输入

localhost:~ shikaixun$ brew install gdb

效果

==> Downloading https://homebrew.bintray.com/bottles/gdb-8.1.high_sierra.bottle.

######################################################################## 100.0%

==> Pouring gdb-8.1.high_sierra.bottle.tar.gz

==> Caveats

gdb requires special privileges to access Mach ports.

You will need to codesign the binary. For instructions, see:

 

  https://sourceware.org/gdb/wiki/BuildingOnDarwin

 

On 10.12 (Sierra) or later with SIP, you need to run this:

 

  echo "set startup-with-shell off" >> ~/.gdbinit

==> Summary

🍺  /usr/local/Cellar/gdb/8.1: 53 files, 9.9MB

验证

输入man gdb

显示:

GDB(1)                       GNU Development Tools                      GDB(1)

 

NAME

       gdb - The GNU Debugger

 

SYNOPSIS

       gdb [-help] [-nh] [-nx] [-q] [-batch] [-cd=dir] [-f] [-b bps]

           [-tty=dev] [-s symfile] [-e prog] [-se prog] [-c core] [-p procID]

           [-x cmds] [-d dir] [prog|prog procID|prog core]

 

DESCRIPTION

       The purpose of a debugger such as GDB is to allow you to see what is

       going on "inside" another program while it executes -- or what another

       program was doing at the moment it crashed.

 

       GDB can do four main kinds of things (plus other things in support of

       these) to help you catch bugs in the act:

 

       o   Start your program, specifying anything that might affect its

           behavior.

 

       o   Make your program stop on specified conditions.

 

:

OK!bingo!

posted @ 2018-06-30 16:39  smileshitou  阅读(299)  评论(0编辑  收藏  举报