Disinstallare OSX-gcc-installer senza prima installare Xcode

2

C'è un modo in cui posso disinstallare osx-gcc-installer senza dover prima installare Xcode, quindi eseguire sudo /Developer/Library/uninstall-devtools —mode=all ?

L'ho installato su Mountain Lion e voglio eliminarlo, quindi i miei strumenti di CLI funzioneranno per installare Octopress .

C'è uno script o un comando che mi aiuterà a rimuovere completamente osx-gcc-installer dal mio sistema?

    
posta Danijel-James W 11.10.2013 - 08:35
fonte

2 risposte

2

Da quello che vedo negli script dello sviluppatore qui , sembra che stia raccomandando di installare Xcode nella parte superiore del suo "osx-gcc-installer" per poter disinstallare ... A quel punto, puoi eseguire lo script uninstall-devtools ...

Dallo sviluppatore:

If something doesn't work as expected, feel free to install Xcode over this installation.

Once installed, you can remove Xcode completely with the following:

sudo /Developer/Library/uninstall-devtools -mode=all

In alternativa, puoi copiare e incollare il contenuto dello script reale in un documento di testo vuoto (magari denominato "uninstall-devtools"), renderlo modificabile ( chmod 755 uninstall-devtools ), e poi eseguirlo ( sudo ./uninstall-devtools -mode=all ):

#!/usr/bin/perl
####################################################################################################
#
# Copyright (c) 2002-2011 Apple, Inc.
# Xcode 4.2
#
# NAME
#     uninstall-devtools -- Meta-script for running the various devtools uninstaller scripts.
#
# SYNOPSIS
#     sudo /Developer/Library/uninstall-devtools --mode=all
#     sudo /Developer/Library/uninstall-devtools --mode=xcodedir
#     sudo /Developer/Library/uninstall-devtools --mode=unixdev
#     sudo /Developer/Library/uninstall-devtools --mode=systemsupport
#
# Where the specified 'mode' value invokes the following devtools uninstaller scripts:
#
#     all:
#         /Library/Developer/Shared/uninstall-devtools
#         /Library/Developer/4.2/uninstall-devtools
#         /Developer/Library/uninstall-developer-folder
#
#     xcodedir:
#         /Developer/Library/uninstall-developer-folder
#
#     unixdev:
#         /Library/Developer/Shared/uninstall-devtools
#
#     systemsupport:
#         /Library/Developer/Shared/uninstall-devtools
#         /Library/Developer/4.2/uninstall-devtools
#
# The default value for 'mode' is 'all'.
#
# DESCRIPTION
#     This command runs the appropriate devtools uninstaller scripts according to the usage
#     specified on the command line.
####################################################################################################

my $do_nothing     = 0;
my $verbose        = 0;
my $warning        = 0;
my $debug          = 0;
my $help           = 0;
my $mode           = '';

get_options(
    'do-nothing' => \$do_nothing,
    'verbose' => \$verbose,
    'warning' => \$warning,
    'debug' => \$debug,
    'help' => \$help,
    'mode' => \$mode,
);

####################################################################################################

if ($help == 1) {
    print("Usage: $0 --mode=<all|xcodedir|unixdev|systemsupport>\n");
print <<"END";
This is a meta-script which invokes one or more of the devtools
uninstaller scripts, depending on which mode you select.

The recognized modes are:
all:
    /Library/Developer/Shared/uninstall-devtools
    /Library/Developer/4.2/uninstall-devtools
    /Developer/Library/uninstall-developer-folder

xcodedir:
    /Developer/Library/uninstall-developer-folder

unixdev:
    /Library/Developer/Shared/uninstall-devtools

systemsupport:
    /Library/Developer/Shared/uninstall-devtools
    /Library/Developer/4.2/uninstall-devtools

The default value for 'mode' is 'all'.
END
    exit(0);
}

####################################################################################################
# Determine if we are authorized to uninstall the devtools packages.
####################################################################################################

$| = 1;
if (($do_nothing == 0) && ($< != 0)) {
    die("ERROR: Must be run with root permissions -- prefix command with 'sudo'.\n");
}

####################################################################################################

my $uninstaller_script = $0;
my ($uninstaller_dir,$uninstaller_script_basename) = parse_name($uninstaller_script);
if ($uninstaller_dir eq '.') {
    die("ERROR: Must change to another directory before running this script, since the current directory is about to be deleted.\n");
}
my ($developer_dir,$developer_dir_basename) = parse_name($uninstaller_dir);

####################################################################################################

my @flags = ();
if ($do_nothing == 1) {
    push(@flags,'--do-nothing');
}
if ($verbose == 1) {
    push(@flags,'--verbose');
}
if ($warning == 1) {
    push(@flags,'--warning');
}
if ($debug == 1) {
    push(@flags,'--debug');
}

if (($mode eq '') || ($mode eq 'all')) {
    run_uninstaller_script("/Library/Developer/4.2/uninstall-devtools",\@flags);
    run_uninstaller_script("/Library/Developer/Shared/uninstall-devtools",\@flags);
    run_uninstaller_script("$developer_dir/Library/uninstall-developer-folder",\@flags);
} elsif ($mode eq 'xcodedir') {
    run_uninstaller_script("$developer_dir/Library/uninstall-developer-folder",\@flags);
} elsif ($mode eq 'unixdev') {
    run_uninstaller_script("/Library/Developer/Shared/uninstall-devtools",\@flags);
} elsif ($mode eq 'systemsupport') {
    run_uninstaller_script("/Library/Developer/4.2/uninstall-devtools",\@flags);
    run_uninstaller_script("/Library/Developer/Shared/uninstall-devtools",\@flags);
} else {
    die("Usage: $0 --mode=<all|xcodedir|shared|systemsupport>\n");
}
print("IMPORTANT: If you are going to install a previous version of the Developer Tools, be sure to restart the machine after installing.\n");

####################################################################################################

sub get_options {
    while (@_) {
    my $option_name = shift(@_);
    my $option_pointer = shift(@_);

    foreach my $arg (@ARGV) {
        if ($arg =~ /^--$option_name/) {
        my ($arg_name,$arg_value) = split(/=/,$arg);
                $arg_value = 1 if (!$arg_value);
        $$option_pointer = $arg_value;
        }
    }
    }
}

####################################################################################################

sub parse_name {
   my $name = shift;
   my ($dir_name,$base_name) = ($name =~ m{^(.*/)?(.*)}s);
   $dir_name =~ s|(.*)/$|$1|s;
   return ($dir_name,$base_name);
}

####################################################################################################

sub run_uninstaller_script {
    my $script = shift;
    my $flagsref = shift;

    if (-x $script) {
        my @args = ();
        push(@args,$script);
        foreach my $flag (@$flagsref) {
            push(@args,$flag);
        }

        system({$args[0]} @args);
    }
}

####################################################################################################
    
risposta data 12.10.2013 - 00:17
fonte
0

Sfortunatamente, osx-gcc-installer ha sovrascritto alcuni file di sistema che sono in realtà "shim", quindi anche se si esegue lo script per cancellare quei file che ha sovrascritto, sarà necessario ripristinare i file di sistema originali.

Per prima cosa, esegui lo script suggerito nell'altra risposta. Poi:

O è possibile scaricare e reinstallare di nuovo l'OSX, dall'App Store. Oppure puoi scaricare gli shimmer di OSX Mavericks da questo torrent e copiarli nella tua cartella / usr / bin, sovrascrivendo quelli che ci sono:

link

Nota: questa è stata la soluzione che ho trovato per OSX Mavericks (10.9), ma potrebbe funzionare anche per te. Fai attenzione nell'usare questi file Mavericks / usr / bin nel tuo Mountain Lion. Quindi potresti voler scaricare di nuovo Mountain Lion e usare una procedura come questa: link

PS: questa risposta dovrebbe includere tutto ciò che devi sapere, ma se hai ancora bisogno di maggiori dettagli, vedi: link

    
risposta data 11.03.2015 - 09:40
fonte

Leggi altre domande sui tag